My apologies if I'm missing something obvious, but I am trying to work out how to have my Arduino respond to RF433 signals from a remote control.
I've successfully followed many tutorials that show me how to use the rc.switch library to decode the signal received from the remote, and then in turn use the RC.Switch library to SEND those codes FROM the Arduino.
However I still have these remotes left over, and want to configure other Arduinos to be able to respond to signals from them. I know I'm doing something wrong here by trying to capture the result of a function into a variable, and perhaps not converting the data types correctly.
Here's what I was trying to do (as a basic proof of concept), this code will not compile due to "C++ forbids comparison between pointer and integer [-fpermissive]".
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
// setup variables for our received data:
unsigned int decvalue();
int bitlength();
void setup() {
Serial.begin(9600);
mySwitch.enableReceive(0); // Receiver on interrupt 0 => that is pin #2
}
void loop() {
if (mySwitch.available())
{
output(mySwitch.getReceivedValue(), mySwitch.getReceivedBitlength(), mySwitch.getReceivedDelay(), mySwitch.getReceivedRawdata(),mySwitch.getReceivedProtocol());
// debug recieved variables
Serial.println(mySwitch.getReceivedValue());
Serial.println(mySwitch.getReceivedBitlength());
Serial.println(mySwitch.getReceivedDelay());
// capture received values
decvalue = mySwitch.getReceivedValue;
bitlength = mySwitch.getReceivedBitlength;
mySwitch.resetAvailable();
// do something with received values
if ((decvalue == 3977006695) && (bitlength == 32))
{
Serial.print("Hello World!");
}
}
}