Arduino RF Remote

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);
}
}

Hi sat001,

programming is a process of breaking down the whole thing into small pieces. Make a testcode for the first small piece test it, correct errors, test it, correct errors, until this piece does work as you want it.

Then make a small testcode for the second small piece test it, correct errors, test it, correct errors, until this piece does work as you want it.

I understand this forum as a place to support learning.

You need a toggle-logic.
first "input-signal" set a variable to status 1
second input-signal set variable to status 2
third input-signal set a variable to status 1
forth input-signal set variable to status 2
etc. etc. etc.

the status of the variable is changed between two values.

write down two if-conditions that do exactyl that.

If you would be stumped now and don't know how to do this.
This would indicate that you have almost no knowledge about programming.
Everyone in this forum started from that point. (It might be it was at the age of four years but all started there)
Then my advice would be start walking up the learning-curve by reading this tutorial:

https://startingelectronics.org/software/arduino/learn-to-program-course/
It starts from zero and It is really easy to understand.

If you would stay on this low knowledge-level you would have to come back with the next small tiny modification and ask for help again, and again and agin. That's not how this forum is meant.

If you can write down the if-conditions post them here and use the insert-code-button <|>

Next step write a small testcode that does wait to receive a single character through the serial interface
and everytime it receives a character change value of status-variable.

best regards Stefan

the logic stays the same regardless of whatever the "input-signal" is.

Dear Mr.Stefan

If you can not support , just leave it , please don’t make unnecessary comment.

Regards.