gateway: blink led when command is ran
This commit is contained in:
parent
8b2cbecae3
commit
067910e394
@ -71,6 +71,12 @@ void readRcSwitch(JsonDocument& jsonDoc) {
|
||||
}
|
||||
}
|
||||
|
||||
void blink() {
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
delay(200);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
}
|
||||
|
||||
void runJsonCommand(String cmd) {
|
||||
StaticJsonDocument<256> jsonArray;
|
||||
DeserializationError err = deserializeJson(jsonArray, cmd);
|
||||
@ -94,6 +100,7 @@ void runJsonCommand(String cmd) {
|
||||
mySwitch.send(rcSwitch["value"]);
|
||||
// Serial.println((const char*)rcSwitch["value"]);
|
||||
}
|
||||
blink();
|
||||
} else {
|
||||
Serial.println(err.c_str());
|
||||
}
|
||||
@ -113,7 +120,7 @@ void readCommand() {
|
||||
cmd = cmd.substring(0, cmd.lastIndexOf(','));
|
||||
}
|
||||
cmd = "[" + cmd + "]";
|
||||
// Serial.println(cmd);
|
||||
Serial.println(cmd);
|
||||
runJsonCommand(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user