Hello everyone!
I have a little issue here I could use some advice with.
So basicall I cam sending Serial Data from my Nextion display to the Arduino.
The Arduino reads the serial data and saves it into a char array.
This works, I have checked the data by printing it via the serial monitor.
Lets say the Serial Data is 65 4 9 1 FF FF FF
with this code:
is actually comparing if incomingByte[2] is equal to sixteen?
No, it's actually deciding if incomingByte[2] is zero or non-zero, chucking away the result, then it is comparing sixteen to fifteen. The compiler knows that is false, so it is probably simply optimising that comparison away.
Well I have checked that by printing the contence of incomingByte to the serial monitor...
I will though fill an array manually and see if that works.
Thanks for the hint.
Ok, got it!
So I checked I converted 15,HEX to DEC, then put 21 in my IF statement and it works.
Now, I understand the arduino converted my 15[HEX] into 21[DEC] in the if statement.
Any way I can compare the value in HEX? I hope you understand, I am only a part-time-programmer...