Could anybody give me a hint on how to solve this.
Below you can find the virtual vire code for RX.
I am reciving the message "hello 6" and trying to do something when buf[6] is equal to 6.
Could it be that i am not converting the value so it can be compared?
When i serial print the buf[6] it prints 6 but when i compare it in the "if" code it does not see it as a 6.
#include <VirtualWire.h>
#undef int
#undef abs
#undef double
#undef float
#undef round
void setup()
{
Serial.begin(9600);
Serial.println("setup");
vw_setup(2000); // Bits per sec
vw_rx_start(); // Start the receiver PLL running
}
void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf, &buflen)) {
int i;
Serial.print("Got: ");
for (i = 0; i < buflen; i++) {
Serial.print(buf[i], BYTE);
Serial.print(" ");
}
Serial.println("");
Serial.println(buf[6]);
if (buf[6] == 6) { Serial.println("ON"); }
}
}