Hi.
I’m not sure what’s going on with my code but I’m slowly loosing my mind trying to figure it out.
I have a FTDI connected to USB, using minicom I can see data transmission and everything looks OK. Each frame looks like this:
68 10 01 00 00 00 00 00 00 00 00 00 00 00 0a 00 00 00 02 00 00 00 00 00 00 00 00 00 00 f9 57 16
Starts with 68, ends with 16, some data in-between.
At this point my code is simple:
void afApp::setup(){
serialConnection.setup("/dev/ttyUSB0", 115200);
serialConnection.flush();
serialConnection.drain();
}
void ofApp::update(){
lastByte=serialConnection.readByte();
ofLog(OF_LOG_NOTICE, "Last byte: " + ofToHex(lastByte));
}
…and I expect to see each byte in separate line but the 16
at the end is missing everytime.
[notice ] Last byte: 68 [notice ] Last byte: 10 [notice ] Last byte: 01 [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: 0a [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: 02 [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: 00 [notice ] Last byte: f9 [notice ] Last byte: 57 [notice ] Last byte: 68 [notice ] Last byte: 10 [notice ] Last byte: 01 [notice ] Last byte: 00 [notice ] Last byte: 00 ...