Recognizes and processes commands
This commit is contained in:
+8
-3
@@ -9,7 +9,7 @@
|
||||
|
||||
char NULLCHAR = 0x0;
|
||||
QueueHandle_t MESSAGES = NULL;
|
||||
|
||||
bool LIGHT = false;
|
||||
|
||||
void vReadSerial(void* params) {
|
||||
// Setup
|
||||
@@ -64,8 +64,13 @@ void vProcessMessages(void* params) {
|
||||
char* command = pvPortMalloc(BUFFER_SIZE * sizeof(char));
|
||||
while(MESSAGES != NULL) {
|
||||
if (xQueueReceive(MESSAGES, command, 50)) {
|
||||
printf("Recieved message: ");
|
||||
printf("%s\n", command);
|
||||
if (strcmp("blink", command)) {
|
||||
printf("Recieved message: ");
|
||||
printf("%s\n", command);
|
||||
} else {
|
||||
LIGHT = !LIGHT;
|
||||
gpio_put(PICO_DEFAULT_LED_PIN, LIGHT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user