
Display a message on PC using UART
main.cpp
- Committer:
- jose_23991
- Date:
- 2014-09-08
- Revision:
- 0:e0af24384f80
File content as of revision 0:e0af24384f80:
//////////////////////////////////////// // Hyperterminal configuration // // 9600 bauds, 8-bit data, no parity // //////////////////////////////////////// #include "mbed.h" Serial serial(SERIAL_TX, SERIAL_RX); DigitalOut myled(LED1); int main() { int i = 1; /* Print the serial header */ serial.printf("\n"); serial.printf("\n------------------------------------------------------"); serial.printf("\n-- SERIAL --"); serial.printf("\n------------------------------------------------------"); serial.printf("\nHello World !"); serial.printf("\n"); while(1) { wait(1); // Wait 1s serial.printf("\n This program runs since %d seconds", i); // Show the counter (seconds) myled = !myled; // Toggle the LED state i++; // Increase the counter (seconds) } }