Improve the serial test by comparing a character type
This commit is contained in:
parent
a251a1492c
commit
f671967c18
|
@ -1,5 +1,7 @@
|
|||
volatile char cmd_char = 'z';
|
||||
|
||||
const char cmd_id = 'i';
|
||||
|
||||
void setup() {
|
||||
Serial.begin(57600);
|
||||
Serial.flush();
|
||||
|
@ -17,7 +19,7 @@ void loop() {
|
|||
}
|
||||
|
||||
void cmd (char val) {
|
||||
if (val == 'i') {
|
||||
Serial.println("i");//End of action
|
||||
if (val == cmd_id) {
|
||||
Serial.println(cmd_id);//End of action
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue