Blink led and show status on UART

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
huyle
Date:
Tue Jan 19 08:03:41 2016 +0000
Parent:
3:f57d754b1814
Commit message:
Nucleo UART example with blink led

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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); 
     }
 }