If you are using 2.1.1 then please look into the C programs in 
the folder /opt/tinyos-2.1.1/support/sdk/c/sf/

For theoritical details, you may also look into TEPs that describe serial 
communication.

Manjunath D

################################################################################################################
***************************************************************************************************************

On Wed, 15 Jun 2011, TJ wrote:

> Hey!!
>
> I am working on interfacing Ububtu with a MicaZ mote. The MicaZ mote is
> sunning XMeshBase from Crossbow examples. I am not able to open and read the
> /dev/ttyUSB1 (there is ttyUSB0 and ttyUSB1 in /dev) file for this. Find
> below my code on the PC side to read and display anything that comes through
> ttyUSB1.
>
> #include <stdio.h>   // Standard input/output definitions
> #include <string.h>  // String function definitions
> #include <unistd.h>  // UNIX standard function definitions
> #include <fcntl.h>   // File control definitions
> #include <errno.h>   // Error number definitions
> #include <termios.h> // POSIX terminal control definitions
> #include <iostream>
> using namespace std;
>
> int main()
> {
>    char a[48];
>    char b[48];
>
>    for(int i=0;i<48;i++)
>    {
>        a[i]=(char)(i+1);
>        b[i]=1;
>    }
>    int mainfd;
>    char chin[100];
>    a[47]=b[47]=0;
>    int c=0;
>    while(1)
>    {
>
>        mainfd=open("/dev/ttyUSB1", O_RDONLY | O_NOCTTY | O_NDELAY);
>
>        read(mainfd, &chin, 1);
>        cout<<chin<<'\n';
>
>    }
>
> }
>
> Is these some command i need to send from the PC to get the data?? Or is my
> code erroneous?? Please Help..
>
>
> Always Yours
> Tejovanth
> Tj n Spook
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to