Dheeraj Kamath
/
BlinkyUart
Toggles LED and prints debug information
Diff: main.cpp
- Revision:
- 2:e83554ed7b87
- Parent:
- 1:e4d41670a405
- Child:
- 3:a773d045cb0d
--- a/main.cpp Sun May 26 17:17:27 2019 +0000 +++ b/main.cpp Sun May 26 17:18:27 2019 +0000 @@ -4,29 +4,25 @@ */ #include "mbed.h" -#include "stats_report.h" DigitalOut led1(LED1); +RawSerial my_uart(UART_TX, UART_RX); #define SLEEP_TIME 500 // (msec) -#define PRINT_AFTER_N_LOOPS 20 // main() runs in its own thread in the OS int main() -{ - SystemReport sys_state( SLEEP_TIME * PRINT_AFTER_N_LOOPS /* Loop delay time in ms */); - - int count = 0; +{ + //Change Baud Rate + my_uart.baud(115200); + my_uart.printf("%s\n\r", "UART Initialized"); + char* msg = "OFF"; + while (true) { // Blink LED and wait 0.5 seconds led1 = !led1; + led1 ? (msg = "OFF"):(msg = "ON"); + my_uart.printf("LED STATE: %s\n\r", msg); wait_ms(SLEEP_TIME); - - if ((0 == count) || (PRINT_AFTER_N_LOOPS == count)) { - // Following the main thread wait, report on the current system status - sys_state.report_state(); - count = 0; - } - ++count; } }