Hello
My teensy project is a simple 16 by 16 analog pressure sensor matrix.
I'm using openFrameworks C++ library to graph teensy analogue sensors values.
I have an weird issue with the openFrameworks serial library. I'm using Teensyduino 1.28 on linux.
The Teensy is programmed in Serial Mode - 72 MHz
If I run my openframeworks programme I don't receive any teensy serial data. If I open the arduino serial monitor after that my openframeworks programme start to read correctly all the teensy serial data.
Arduino partial code
openframeworks partial code
My teensy project is a simple 16 by 16 analog pressure sensor matrix.
I'm using openFrameworks C++ library to graph teensy analogue sensors values.
I have an weird issue with the openFrameworks serial library. I'm using Teensyduino 1.28 on linux.
The Teensy is programmed in Serial Mode - 72 MHz
If I run my openframeworks programme I don't receive any teensy serial data. If I open the arduino serial monitor after that my openframeworks programme start to read correctly all the teensy serial data.
Arduino partial code
Code:
void UsbTransmit() {
if ( ( millis() - lastFrameTime ) >= FRAME_RATE ) {
lastFrameTime = millis();
for ( int row = 0; row < ROW; row++ ) {
// Set row pin as output +3V
pinMode( rowPins[row], OUTPUT );
digitalWrite( rowPins[row], HIGH );
for ( int column = 0; column < COL; column++ ) {
int value = analogRead( columnPins[column] ); // Read the sensor value
Serial.write( value & B01111111 ); // Write lowByte
Serial.write( (value >> 7) & B00000111 ); // Write highByte
}
Serial.send_now(); // Send 32 bytes now
// Set row pin in high-impedance state
pinMode( rowPins[row], INPUT );
}
Serial.write( 255 ); // Write the footer
Serial.send_now(); // Send the footer now
}
}
openframeworks partial code
Code:
void ofApp::setup(){
serial.setup( "dev/ttyACM0" , 230400 ){
}
void ofApp::update() {
if( serial.available() ) {
inputValue = serial.readByte();
if ( inputValue == FOOTER ) {
index = 0;
}else {
serialData[index] = inputValue;
index++;
}
}