Arduino test firmware for serial comms

Use for timing tests, configuration protocols (figuring out what is
attached and which arduino handles which function)
This commit is contained in:
mmcwilliams 2016-04-11 17:06:05 -04:00
parent f594ae9b34
commit 480a0df3dd
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
volatile char cmd_char = 'z';
void setup() {
Serial.begin(57600);
Serial.flush();
}
void loop() {
if (Serial.available()) {
/* read the most recent byte */
cmd_char = (char)Serial.read();
}
if (cmd_char != 'z') {
cmd(cmd_char);
cmd_char = 'z';
}
}
void cmd (char val) {
if (val == 'a') {
Serial.println("a");//End of action
}
}