Same as freertos_bluetooth but now with FreeRTOS v_8.2.1
Dependencies: mbed m3pi FreeRTOS_V8_2_1_LPC1768
Diff: main.cpp
- Revision:
- 5:97a449a1e05f
- Parent:
- 4:33929b1afb80
- Child:
- 6:00f820418d01
--- a/main.cpp Wed Dec 05 17:56:16 2018 +0000 +++ b/main.cpp Wed Dec 05 18:13:24 2018 +0000 @@ -24,7 +24,7 @@ { (void) pvParameters; // Just to stop compiler warnings. - char *cBufferBT; + int i; rn41.baud(115200); led1 = 1; @@ -45,12 +45,13 @@ if (rn41.readable()) { // When BT is readable - sprintf(cBufferBT, "%d", rn41.getc()); // Reads Bluetooth - m3pi.locate(0,1); // Prints the received message on the LCD - m3pi.print(cBufferBT, 8); + i = rn41.getc(); // Reads Bluetooth + led2 = i; // The received[0 / 1] turns [off / on] LED2 - rn41.putc(6); // Send message to the BT terminal - led2 = !led2; + if(rn41.writeable()) { + rn41.putc(led2); // Send LED2 state to the BT terminal + } + } led1 = !led1;