View Full Version : read from USB serial port of raspberry pi with serialGetchar()

31st July 2018, 18:03
I use wiringSerial.h library to read from USB port of raspi in thread

void MyThread::run()

qDebug("Thread id inside run %d",(int)QThread::currentThreadId());

int fd ,value;

if ((fd = serialOpen ("/dev/ttyACM0",230400)) < 0)
fprintf (stderr, "Unable to open serial device: %s\n", strerror (errno)) ;

while (serialDataAvail(fd)>-2)

value=serialGetchar (fd) ;

emit signalValueUpdated(value);


the data that received is a number between -1 to 255
when use value in emit signal Value Updated(value); or print it
the value is not the same value that send to raspberry pi, what should I do?

2nd August 2018, 11:14
Show serialDataAvail() and serialGetChar().