Conform serial coms to style

Receive char and respond with char when action is done
This commit is contained in:
Matt 2016-04-18 12:26:50 -04:00
parent 479240a6c3
commit 2290641b30
2 changed files with 20 additions and 10 deletions

View File

@ -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,12 +51,12 @@ void loop () {
//l - light - followed by String
//
void cmd (char val) {
if (val == 'i') {
Serial.println("i");//confirm connection
} else if (val == 'l') {
colorString();
Serial.println("l");//End of action
}
if (val == cmd_connect) {
Serial.println(cmd_connect);//confirm connection
} else if (val == cmd_light) {
colorString();
Serial.println(cmd_light);//confirm light change
}
}
void colorString () {

View File

@ -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
}
}