#include RCSwitch mySwitch = RCSwitch(); int mode = 0; boolean on = false; void setup() { Serial.begin(9600); mySwitch.enableTransmit(3); } void loop() { if(Serial.available()) { mode = Serial.read(); switch (mode) { case 126: if(on) { controlRCOutlets("0FFF0FFF0000"); Serial.println("Light is off."); on = false; } else { controlRCOutlets("0FFF0FFF000F"); Serial.println("Light is on."); on = true; } break; } } } void controlRCOutlets(const char* sCodeWord) { mySwitch.sendTriState(sCodeWord); delay(1000); }