I have a 433Mhz Superheterodyne receiver and a hand set remote of similar frequency, I'm using the RC-Switch library and I couldn't find a better way than using the "numbers" that I'm receiving like this:
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
void setup() {
Serial.begin(9600);
mySwitch.enableReceive(0); // Receiver on interrupt 0 => that is pin #2
pinMode(13, OUTPUT);
}
void loop() {
if (mySwitch.getReceivedValue() == 7264305) {
digitalWrite(13, LOW);
}
if (mySwitch.getReceivedValue() == 7264308) {
digitalWrite(13, HIGH);
}
if (mySwitch.getReceivedValue() == 7264306) {
mySwitch.resetAvailable();
}
}
Is there any other (better?) way than just using the "numbers" simply like that or everyone are using their remote commands like I'm using?
7264305
translates to 24 bit binary011011101101100000110001
, which can be described in hexadecimal as6ED831
.... some of the bits are the switch states and the rest are probably a predetermined filler that could be used to check the validity of the transmission or they may be the address of the transmitter7264305
,7264306
and7264308
, the last 4 bits of the received data are0001
,0010
and0100
respectively