response: "Ok", "Already closed", "Error: .*"
o ... open
response: "Ok", "Already opened", "Error: .*"
+ t ... toggle
+ responce: "Ok", "Error: .*"
s ... status
response: "Status: closed|opened|<->, opening|waiting|closing|idle"
or "Error: .*"
#define CMD_OPEN 'o'
#define CMD_CLOSE 'c'
+#define CMD_TOGGLE 't'
#define CMD_STATUS 's'
#define CMD_RESET 'r'
else
Serial.println("Error: Operation in progress");
}
+ else if (command == CMD_TOGGLE) {
+ if(current_state == IDLE) {
+ if(is_closed())
+ start_open();
+ else
+ start_close();
+ Serial.println("Ok");
+ }
+ else
+ Serial.println("Error: Operation in progress");
+ }
else if (command == CMD_STATUS)
print_status();
else