Blink led and show status on UART

Dependencies:   mbed

Committer:
huyle
Date:
Tue Jan 19 08:03:41 2016 +0000
Revision:
4:fd6be3032e56
Parent:
2:b60cb847489c
Nucleo UART example with blink led

Who changed what in which revision?

UserRevisionLine numberNew contents of line
huyle 4:fd6be3032e56 1 /**********************************************************************************
huyle 4:fd6be3032e56 2 * @file main.cpp
huyle 4:fd6be3032e56 3 * @author HuyLe <anhhuy@live.com>
huyle 4:fd6be3032e56 4 * @version V0.1
huyle 4:fd6be3032e56 5 * @date 19-Jan-2016
huyle 4:fd6be3032e56 6 * @brief Nucleo UART example
huyle 4:fd6be3032e56 7 ***********************************************************************************/
screamer 0:005629fe3609 8 #include "mbed.h"
screamer 0:005629fe3609 9
huyle 4:fd6be3032e56 10 Serial pc(SERIAL_TX, SERIAL_RX);
screamer 0:005629fe3609 11 DigitalOut myled(LED1);
screamer 0:005629fe3609 12
huyle 4:fd6be3032e56 13 int main()
huyle 4:fd6be3032e56 14 {
huyle 4:fd6be3032e56 15 //pc.baud(9600);
huyle 4:fd6be3032e56 16 int i = 1;
huyle 4:fd6be3032e56 17 pc.printf("\t :::::Testing UART Dislay:::::\r\n");
huyle 4:fd6be3032e56 18 pc.printf("\t Configure Tera Term: 9600 bauds, 8-bit data, \
huyle 4:fd6be3032e56 19 no parity, 1 stop bit.\r\n");
screamer 0:005629fe3609 20 while(1) {
huyle 4:fd6be3032e56 21 pc.printf("\t => Counts: %d \r\n", i++);
huyle 4:fd6be3032e56 22 myled = 1;
huyle 4:fd6be3032e56 23 pc.printf("\t LED is ON\r");
huyle 4:fd6be3032e56 24 wait(3.0);
huyle 4:fd6be3032e56 25 myled = 0;
huyle 4:fd6be3032e56 26 pc.printf("\t LED is OFF\r");
huyle 4:fd6be3032e56 27 wait(3.0);
screamer 0:005629fe3609 28 }
screamer 0:005629fe3609 29 }