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:
parent
f594ae9b34
commit
480a0df3dd
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue