huy le
/
Nucleo_blink_led
Blink led and show status on UART
Diff: main.cpp
- Revision:
- 4:fd6be3032e56
- Parent:
- 2:b60cb847489c
--- a/main.cpp Thu Nov 06 10:13:20 2014 +0000 +++ b/main.cpp Tue Jan 19 08:03:41 2016 +0000 @@ -1,12 +1,29 @@ +/********************************************************************************** +* @file main.cpp +* @author HuyLe <anhhuy@live.com> +* @version V0.1 +* @date 19-Jan-2016 +* @brief Nucleo UART example +***********************************************************************************/ #include "mbed.h" +Serial pc(SERIAL_TX, SERIAL_RX); DigitalOut myled(LED1); -int main() { +int main() +{ + //pc.baud(9600); + int i = 1; + pc.printf("\t :::::Testing UART Dislay:::::\r\n"); + pc.printf("\t Configure Tera Term: 9600 bauds, 8-bit data, \ + no parity, 1 stop bit.\r\n"); while(1) { - myled = 1; // LED is ON - wait(0.2); // 200 ms - myled = 0; // LED is OFF - wait(1.0); // 1 sec + pc.printf("\t => Counts: %d \r\n", i++); + myled = 1; + pc.printf("\t LED is ON\r"); + wait(3.0); + myled = 0; + pc.printf("\t LED is OFF\r"); + wait(3.0); } }