on-internet
← Community

Read /dev/ttyUSB0 with a c program on LINUX

Stack Overflow ·

I want to read data frames sent by a GPS XBee protocol. The USB XStick receives the following data: CHARS : 15931 SENTENCES = 0 CHECKSUM : 58 Heading : 55 Tilt: -46 Roll:2 CHARS : .... and so on ... I can read by typing in the terminal control : $ screen /dev/ttyUSB0 I'd like to see these details in the same way, but with a program written in C. Here's what I do : #include <stdio.h> #include <stdlib.h> #include <termios.h> #include <sys/fcntl.h> #include <unistd.h> #include "serial_port.h" void read_Serial_Port(const char* DEVICE_PORT) { int file; struct termios options; char message[100]; uns

Comments

Sign in or sign up to comment and upvote.

No comments yet.