I'm having a trouble with the following code... If i put InData[0] == 0x79, everything works, however if it is greater than 0x80, it doesn't work. I think it is because of the signed value, is there any other way to do this.
I canno't change de data that i'm receiving, its always 4 hex bytes in the format 0xf0100101
Thank you
char inData[4];
void setup()
{
Serial.begin(9600);
}
void loop() {
if (Serial.available() > 0) {
Serial.readBytes(inData,4);
//Verifica se é Actuador
if (inData[0] == 0xf0) //If greater that 0x79 don't work
{
if (inData[1] == 0x10)
{
if (inData[2] == 0x01)
{
if (inData[3] == 0x01)
{
Serial.println("ok");
}
}
}
}
}
}
Binary sketch size: 1,946 bytes (of a 32,256 byte maximum)
...no errors.
Arduino 1.5...
Sketch uses 2,090 bytes (6%) of program storage space. Maximum is 32,256 bytes.
Global variables use 190 bytes (9%) of dynamic memory, leaving 1,858 bytes for local variables. Maximum is 2,048 bytes.