#include RCSwitch mySwitch = RCSwitch(); long int keycode=0; long int temp_keycode=0; void setup() { Serial.begin(9600); Serial1.begin(38400); mySwitch.enableReceive(digitalPinToInterrupt(13)); } void loop() { if (mySwitch.available()) { Serial.print("Received "); Serial.print( mySwitch.getReceivedValue() ); Serial.print(" / "); Serial.print( mySwitch.getReceivedBitlength() ); Serial.print("bit "); Serial.print("Protocol: "); Serial.println( mySwitch.getReceivedProtocol() ); keycode=mySwitch.getReceivedValue(); if (keycode==16736113) {Serial1.print("RELAY-KEY-255,1,1");} //toggle relay1 if (keycode==14527912 ) {Serial1.print("RELAY-KEY-255,2,1");} //toggle relay2 if (keycode==16736114 ) {Serial1.print("RELAY-KEY-255,3,1");} //toggle relay3 if (keycode==16736120) {Serial1.print("RELAY-KEY-255,4,1");} //toggle relay4 if (keycode==2233874) {Serial1.print("RELAY-KEY-255,5,1");} //toggle relay5 if (keycode==2233876) {Serial1.print("RELAY-KEY-255,6,1");} //toggle relay6 if (keycode==20501) {Serial1.print("RELAY-KEY-255,7,1");} //toggle relay7 if (keycode==20500) {Serial1.print("RELAY-KEY-255,8,1");} //toggle relay8 if (keycode==5576131) {Serial1.print("RELAY-KEY-255,9,1");} //toggle relay9 if (keycode==5575951) {Serial1.print("RELAY-KEY-255,10,1");} //toggle relay10 if (keycode==5576188) {Serial1.print("RELAY-KEY-255,11,1");} //toggle relay11 if (keycode==5576179) {Serial1.print("RELAY-KEY-255,12,1");} //toggle relay12 if (keycode==5576191) {Serial1.print("RELAY-KEY-255,13,1");} //toggle relay13 if (keycode==5576128) {Serial1.print("RELAY-KEY-255,14,1");} //toggle relay14 if (keycode==5575987) {Serial1.print("RELAY-KEY-255,15,1");} //toggle relay15 if (keycode==5575936) {Serial1.print("RELAY-KEY-255,16,1");} //toggle relay16 mySwitch.resetAvailable(); } }