AdmiralCrunch
Well-known member
Hi,
when a switchbutton is pressed, I am sending a string via Serial1 from a Teensy3.2 to a Raspi3, where I catch it with NodeJS.
Everything works fine but If I send a string greater then 8 chars, Serial1.send() seems to split the request into two.. oO .. what is that? how can I fix that?
when a switchbutton is pressed, I am sending a string via Serial1 from a Teensy3.2 to a Raspi3, where I catch it with NodeJS.
Code:
#include <Bounce.h>
#include <cfg.h>
cfg cfg;
Bounce btnShift = Bounce(12, 10); // 10 ms debounce
void setup() {
pinMode(12, INPUT_PULLUP);
Serial.begin(9600);
while ( !Serial && (millis() < 4000) ) {
Serial.println("LOADING SERIAL PORT ...");
}
Serial1.begin(9600);
while ( !Serial1 && (millis() < 4000) ) {
Serial1.println("LOADING Serial1 PORT ...");
}
Serial.println("SERIAL PORT INITIALIZED");
Serial.println("Serial1 PORT INITIALIZED");
}
void loop() {
pollShift();
}
void pollShift() {
if (btnShift.update()) {
if (btnShift.fallingEdge()) {
cfg.shiftStatus = true;
Serial.println("Shift pressed..");
Serial1.write("bla:110");
} else {
Serial.println("Shift released..");
cfg.shiftStatus = false;
}
}
}
Everything works fine but If I send a string greater then 8 chars, Serial1.send() seems to split the request into two.. oO .. what is that? how can I fix that?