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';
|
volatile char cmd_char = 'z';
|
||||||
|
|
||||||
|
const char cmd_id = 'i';
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(57600);
|
Serial.begin(57600);
|
||||||
Serial.flush();
|
Serial.flush();
|
||||||
|
@ -17,7 +19,7 @@ void loop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmd (char val) {
|
void cmd (char val) {
|
||||||
if (val == 'i') {
|
if (val == cmd_id) {
|
||||||
Serial.println("i");//End of action
|
Serial.println(cmd_id);//End of action
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue