Hello,
I am having a problem and I can’t resolve it.
I am usgin an rfid card reader (https://www.sparkfun.com/products/13198) that has an usb port, that I connect directly to my computer (no Arduino). I am trying to get cards id inside openframeworks and seems ofSerial is not working. Here is a sample code
#include "testSerial.h"
void testSerial::setup()
{
serial.listDevices();
int baud = 9600;
serial.setup("/dev/ttyUSB0", baud);
cout << "setup done" << endl;
cout << serial.isInitialized() << endl;
}
void testSerial::update(){
int newByte = serial.readByte();
while(newByte!=OF_SERIAL_NO_DATA && newByte!=OF_SERIAL_ERROR){
cout << (char)newByte << endl;
newByte = serial.readByte();
}
if(newByte==OF_SERIAL_ERROR){
cout << "SERIAL ERROR"<< endl;
serial.close();
}
}
void testSerial::draw()
{
}
Here is outpput:
[notice ] ofSerial: [0] = ttyUSB0
[notice ] ofSerial: [1] = ttyS3
[notice ] ofSerial: [2] = ttyS2
[notice ] ofSerial: [3] = ttyS1
[notice ] ofSerial: [4] = ttyS0
[notice ] ofSerial: opening /dev/ttyUSB0 @ 9600 bps
[notice ] ofSerial: opened /dev/ttyUSB0 sucessfully @ 9600 bps
setup done
1
Important details: Baud rate is set ok and my user is added to dialout group.
I verify on Arduino monitor console, GTKTerm and Processing, and the card reader is working fine.
I’ve tested on of_v0.9.3 on Fedora and Raspbian.
Is it a bug? Is something that I am missing?
Any help or guidance would be appreciated