Hi
Please find attached my code, this is RF receiver, two remote button has been used to control an output.
Actually I wanted to control two output with toggle mode (same button should be used to ON/OFF one output), the given code is working fine with single out put with two button, I tried many ways but can’t succeed , can somebody please help me to solve.
Thanks & Regards
/*
Example for receiving
If you want to visualize a telegram copy the raw data and
paste it into http://test.sui.li/oszi/
*/
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
int LED = 13;
boolean statusled = LOW;
void setup() {
pinMode(LED, OUTPUT);
Serial.begin(9600);
mySwitch.enableReceive(0); // Receiver on interrupt 0 => that is pin #2
}
void loop() {
if (mySwitch.available())
{
Serial.print(mySwitch.getReceivedValue());
unsigned long int num = mySwitch.getReceivedValue();
Serial.print(num);
switch(num)
{
case 5592515: mySwitch.disableReceive();
statusled = HIGH;
break;
case 5592320: mySwitch.disableReceive();
statusled = LOW;
break;
}
digitalWrite(LED, statusled);
unsigned long time_now = millis();
int ck = 500;
while(millis() < time_now + ck)
{;}
mySwitch.resetAvailable();
mySwitch.enableReceive(0);
}
}