How to read serial data from in Linux with C -
i'm trying write code read data serial port continuously in loop , write file. i'm beginner programmer.
i gather can use fopen()
open "file" serial port, code does.
my question how read continuously , write file. baud rate 115200 , there line feeds , carriage returns. how specify parameters?
file *fp = fopen("/dev/ttyusb1", "r"); if (!fp) { perror("open failed"); exit(1); } else { // read file }
if open serial port minicom data looks like:
starting contiki-1cb08a4 driverlib v0.44336 ti smartrf06eb + cc26xx em net: sicslowpan mac: tsch2 rdc: nordc rf: channel 25 [node] id=0, role=6ln starting contiki-1cb08a4 driverlib v0.44336 ti smartrf06eb + cc26xx em net: sicslowpan mac: tsch2 rdc: nordc rf: channel 25 [node] id=0, role=6ln
Comments
Post a Comment