rc-switch icon indicating copy to clipboard operation
rc-switch copied to clipboard

How to add a new protocol for my RF receiver

Open cyberdomotik opened this issue 5 months ago • 1 comments

Hello everyone,

I follow the instructions indicated in "Add_New_Remote_Part_1" to add my custom protocol, but I do not know how to do it. I have tried two ways without success.

-First way: In my void setup i have this:

void setup() { static const RCSwitch::Protocol customprotocol = { 450, { 6, 2 }, { 2, 2 }, { 1, 3 }, true }; mySwitch.setProtocol(customprotocol); Serial.begin(9600); mySwitch.enableReceive(0); // Receiver on interrupt 0 => that is pin #2 Serial.println("Esperando datos..."); } ...but it does not work, the serial monitor does not show any received data with this custom protocol.

-Another way: I include in the RCSwitch.cpp file a line for my protocol like this

#if defined(ESP8266) || defined(ESP32) static const VAR_ISR_ATTR RCSwitch::Protocol proto[] = { #else static const RCSwitch::Protocol PROGMEM proto[] = { #endif { 350, { 1, 31 }, { 1, 3 }, { 3, 1 }, false }, // protocol 1 { 650, { 1, 10 }, { 1, 2 }, { 2, 1 }, false }, // protocol 2 { 100, { 30, 71 }, { 4, 11 }, { 9, 6 }, false }, // protocol 3 { 380, { 1, 6 }, { 1, 3 }, { 3, 1 }, false }, // protocol 4 { 500, { 6, 14 }, { 1, 2 }, { 2, 1 }, false }, // protocol 5 { 450, { 23, 1 }, { 1, 2 }, { 2, 1 }, true }, // protocol 6 (HT6P20B) { 150, { 2, 62 }, { 1, 6 }, { 6, 1 }, false }, // protocol 7 (HS2303-PT, i. e. used in AUKEY Remote) { 200, { 3, 130}, { 7, 16 }, { 3, 16}, false}, // protocol 8 Conrad RS-200 RX { 200, { 130, 7 }, { 16, 7 }, { 16, 3 }, true}, // protocol 9 Conrad RS-200 TX { 365, { 18, 1 }, { 3, 1 }, { 1, 3 }, true }, // protocol 10 (1ByOne Doorbell) { 270, { 36, 1 }, { 1, 2 }, { 2, 1 }, true }, // protocol 11 (HT12E) { 320, { 36, 1 }, { 1, 2 }, { 2, 1 }, true } // protocol 12 (SM5212) { 450, { 6, 2 }, { 2, 2 }, { 1, 3 }, true }, // protocol 13 (custom) };

...but it doesn't work either and any data is shown from the serial monitor.

I have verified that my protocol is correct by sending the signal from an RF transmitter and checking that the equipment responds correctly.

Please how should the protocol be added correctly? Any help will be welcome

cyberdomotik avatar Jan 19 '24 20:01 cyberdomotik