Conform serial coms to style
Receive char and respond with char when action is done
This commit is contained in:
parent
479240a6c3
commit
2290641b30
|
@ -20,6 +20,11 @@ volatile int r = 0;
|
|||
volatile int g = 0;
|
||||
volatile int b = 0;
|
||||
|
||||
const char cmd_debug = 'd';
|
||||
const char cmd_connect = 'i';
|
||||
|
||||
const char cmd_light = 'l';
|
||||
|
||||
volatile char cmd_char = 'z';
|
||||
const int serialDelay = 5;
|
||||
|
||||
|
@ -46,11 +51,11 @@ void loop () {
|
|||
//l - light - followed by String
|
||||
//
|
||||
void cmd (char val) {
|
||||
if (val == 'i') {
|
||||
Serial.println("i");//confirm connection
|
||||
} else if (val == 'l') {
|
||||
if (val == cmd_connect) {
|
||||
Serial.println(cmd_connect);//confirm connection
|
||||
} else if (val == cmd_light) {
|
||||
colorString();
|
||||
Serial.println("l");//End of action
|
||||
Serial.println(cmd_light);//confirm light change
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,11 @@ volatile int r = 0;
|
|||
volatile int g = 0;
|
||||
volatile int b = 0;
|
||||
|
||||
const char cmd_debug = 'd';
|
||||
const char cmd_connect = 'i';
|
||||
|
||||
const char cmd_light = 'l';
|
||||
|
||||
volatile char cmd_char = 'z';
|
||||
const int serialDelay = 5;
|
||||
|
||||
|
@ -56,11 +61,11 @@ void loop () {
|
|||
//l - light - followed by String
|
||||
//
|
||||
void cmd (char val) {
|
||||
if (val == 'i') {
|
||||
Serial.println("i");//confirm connection
|
||||
} else if (val == 'l') {
|
||||
if (val == cmd_connect) {
|
||||
Serial.println(cmd_connect);//confirm connection
|
||||
} else if (val == cmd_light) {
|
||||
colorString();
|
||||
Serial.println("l");//confirm light change
|
||||
Serial.println(cmd_light);//confirm light change
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue