Show Posts
Pages: [1]
1  Using Arduino / Interfacing w/ Software on the Computer / Re: debugging a serial communication tool on: November 09, 2012, 01:09:03 pm
it is code that runs on my netbook.
ive done some experimenting and it seems, that when i run the code with the arduino connectet, the arduino reboots. on the arduino runs the SerialDisplay example, wich puts everything from the serial input off the arduino to a lcd (and this works, ive testet it with the serial monitor).
this code works, as long as i have the serial monitor open.
2  Using Arduino / Interfacing w/ Software on the Computer / debugging a serial communication tool on: November 09, 2012, 12:13:40 pm
hey guys, i need some help debugging this code:
Code:
int open_portandprint(char* load){
int fd; /* File descriptor for the port */
fd = open("/dev/ttyACM0", O_RDWR | O_NDELAY);
    fcntl(fd, F_SETFL, 0);
struct termios options,oldtios;
if (tcgetattr(fd, &oldtios) != 0) return(-1);
cfsetispeed(&options, B9600);            /* setze 9600 bps */
cfsetospeed(&options, B9600);
options.c_cflag &= ~PARENB;               /*  kein Paritybit */
options.c_cflag &= ~CSTOPB;               /* 1 Stopbit */
  options.c_cflag &= ~CSIZE;                /* 8 Datenbits */
  options.c_cflag |= CS8;
options.c_oflag &= ~OPOST;
tcsetattr(fd, TCSANOW, &options);

int n = 0;
int m = strlen(load);
n =  write(fd, load, m);
return (fd);
    }
it should initialize the virtual com port on my computer and write some bytes of code. but in only works, while i have telnet up an running. so i think some of my flags are wrong.
can somebody see what my problem is?
thank so far,
erik
Pages: [1]