Closed dmsherazi closed 6 years ago
Hi @dmsherazi, sorry I didn't see this at the time.
I don't see anything wrong with your code up to the sp_open()
call. You are most likely getting an error reported from the OS when you attempt to open the port. My guess would be that you don't have the right permissions to open /dev/ttyUSB0
.
You can run with the environment variable LIBSERIALPORT_DEBUG=1 to get debug output which will show what the error being returned is. Or check in your code for SP_ERR_FAIL
being returned, and if so, call sp_last_error_message()
to get the error message from the OS.
I am following this example code
after compiling with libserialport and executing this code on Ubuntu desktop here is the output
I am not able to understand why and how to fix it!