Hi @salman !
I’ve advenced a little bit, I have two Arduino, one Nano for the transmittor and a Mega 2560 for the receiver, I want to know how send different message with the different remote’s buttons, this is my remote:
https://www.amazon.co.uk/XuBa-Universal-Wireless-Cloning-Electric/dp/B07H7L8DDT/ref=sr_1_6?crid=3KQNXLGVBZF9U&dchild=1&keywords=universal+radio+remote+control&qid=1592381683&sprefix=universal+radio+%2Caps%2C189&sr=8-6
If I understood correctly, I must put a code on the transmitter, copy it to my remote control, and therefore on each button there will be a different code, with the rc_switch library I managed to establish a connection between the 2. here are my 2 codes:
TRANSMITTOR:
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
void setup() {
Serial.begin(9600);
// Transmitter is connected to Arduino Pin #10
mySwitch.enableTransmit(10);
// Optional set pulse length.
mySwitch.setPulseLength(276);
// Optional set number of transmission repetitions.
mySwitch.setRepeatTransmit(15);
}
void loop() {
/* Same switch as above, but using binary code */
mySwitch.send(“101100001101111001000100”);
delay(1000);
}
RECEIVER:
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
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());
mySwitch.resetAvailable();
}
}
And this is my external output:
So I want to know how do different action, and THANK YOU very much for your quick reply !!