|
|
|
@ -16,10 +16,24 @@ void setup() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void process_command(String command, String param) { |
|
|
|
|
// LED Stripes
|
|
|
|
|
if (command == "fade" || command == "f") fade_to(param.toInt()); |
|
|
|
|
if (command == "led" || command == "l") toggle_stripes(param); |
|
|
|
|
if (command == "on" || command == "1") switch_230("on", param); |
|
|
|
|
if (command == "off" || command == "0") switch_230("off", param); |
|
|
|
|
|
|
|
|
|
// Radio switches
|
|
|
|
|
if (command == "a" || |
|
|
|
|
command == "b" || |
|
|
|
|
command == "c" || |
|
|
|
|
command == "d") switch_230(param, command); |
|
|
|
|
|
|
|
|
|
// Turn all on or off
|
|
|
|
|
if (command == "off" || command == "on") { |
|
|
|
|
switch_230(command, "a"); |
|
|
|
|
switch_230(command, "b"); |
|
|
|
|
switch_230(command, "c"); |
|
|
|
|
switch_230(command, "d"); |
|
|
|
|
toggle_stripes(command); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Serial.println("Ok"); |
|
|
|
|
} |
|
|
|
@ -33,12 +47,15 @@ void switch_230(String state, String number) {
|
|
|
|
|
if (number == "d") device = "00010"; |
|
|
|
|
if (number == "e") device = "00001"; |
|
|
|
|
|
|
|
|
|
if (state == "on") rc_switch.switchOn(code, device); |
|
|
|
|
if (state == "off") rc_switch.switchOff(code, device); |
|
|
|
|
if (state == "on" || state == "1") { |
|
|
|
|
rc_switch.switchOn(code, device); |
|
|
|
|
} else { |
|
|
|
|
rc_switch.switchOff(code, device); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void toggle_stripes(String on_or_off) { |
|
|
|
|
if (on_or_off == "on") { |
|
|
|
|
if (on_or_off == "on" || on_or_off == "1") { |
|
|
|
|
fade_to(255); |
|
|
|
|
digitalWrite(led_stripe, HIGH); |
|
|
|
|
} else { |
|
|
|
|