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 g = 0;
|
||||||
volatile int b = 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';
|
volatile char cmd_char = 'z';
|
||||||
const int serialDelay = 5;
|
const int serialDelay = 5;
|
||||||
|
|
||||||
|
@ -46,12 +51,12 @@ void loop () {
|
||||||
//l - light - followed by String
|
//l - light - followed by String
|
||||||
//
|
//
|
||||||
void cmd (char val) {
|
void cmd (char val) {
|
||||||
if (val == 'i') {
|
if (val == cmd_connect) {
|
||||||
Serial.println("i");//confirm connection
|
Serial.println(cmd_connect);//confirm connection
|
||||||
} else if (val == 'l') {
|
} else if (val == cmd_light) {
|
||||||
colorString();
|
colorString();
|
||||||
Serial.println("l");//End of action
|
Serial.println(cmd_light);//confirm light change
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void colorString () {
|
void colorString () {
|
||||||
|
|
|
@ -28,6 +28,11 @@ volatile int r = 0;
|
||||||
volatile int g = 0;
|
volatile int g = 0;
|
||||||
volatile int b = 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';
|
volatile char cmd_char = 'z';
|
||||||
const int serialDelay = 5;
|
const int serialDelay = 5;
|
||||||
|
|
||||||
|
@ -56,11 +61,11 @@ void loop () {
|
||||||
//l - light - followed by String
|
//l - light - followed by String
|
||||||
//
|
//
|
||||||
void cmd (char val) {
|
void cmd (char val) {
|
||||||
if (val == 'i') {
|
if (val == cmd_connect) {
|
||||||
Serial.println("i");//confirm connection
|
Serial.println(cmd_connect);//confirm connection
|
||||||
} else if (val == 'l') {
|
} else if (val == cmd_light) {
|
||||||
colorString();
|
colorString();
|
||||||
Serial.println("l");//confirm light change
|
Serial.println(cmd_light);//confirm light change
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue