Good Afternoon. I amm sending the following through serial3 to another device (display)
The value right now is let say 1023
The receiving end only gets 102.
Any idea how to verify if i am actually sendit all of bytes? (don`t have scope unfortunetly) or is it the reveiving end problem.
Thanks
void setup() {
Serial.begin(115200);
Serial3.begin(115200);
}
void loop() {
int sensorValue = analogRead(A0);
String sensorValueString = String(sensorValue);;
byte sensorValueBytes[sensorValueString.length()];
sensorValueString.getBytes(sensorValueBytes, sensorValueString.length());
Serial.println(sensorValueString);
byte hexValues[] = { 0xAA, 0x98, 0x02, 0x94, 0x00, 0xFA, 0x1a, 0x21, 0x08, 0x9e, 0x42, 0x00, 0x00, sensorValueBytes[0], sensorValueBytes[1], sensorValueBytes[2],sensorValueBytes[3], 0xCC, 0x33, 0xC3, 0x3C }; //start marker(AA), command(98), position (0294-00FA),font_id(1a), font transparent background(21), font size(08),font colour(9e42),bgk colour( 0000),Value, end markers (CC,33,C3,3C)
int numBytes = sizeof(hexValues) / sizeof(hexValues[0]);
// Write the hexadecimal values to serial
for (int i = 0; i < numBytes; i++) {
Serial3.write(hexValues[i]);
}
delay(100);
}
Why not just send this: byte hexValues[] = { 0xAA, 0x98, 0x02, 0x94, 0x00, 0xFA, 0x1a, 0x21, 0x08, 0x9e, 0x42, 0x00, 0x00, 0x31,0x30,0x32,0x33, 0xCC, 0x33, 0xC3, 0x3C };
and see if it's received correctly? Note, I've hardcoded your four digit number, so you definitely should receive it. If not, we can investigate further with other things to try, like verifying it receives 3-digit values correctly.