Display a message on PC using UART.

Dependencies:   mbed

Committer:
arostm
Date:
Wed Jun 07 13:16:58 2017 +0000
Revision:
3:14dc18aceca9
Parent:
2:08c13f9a3d5c
Adding new mbed library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 0:028fac66239d 1 #include "mbed.h"
bcostm 1:e9d1c42a73ae 2
bcostm 1:e9d1c42a73ae 3 //------------------------------------
bcostm 1:e9d1c42a73ae 4 // Hyperterminal configuration
bcostm 1:e9d1c42a73ae 5 // 9600 bauds, 8-bit data, no parity
bcostm 1:e9d1c42a73ae 6 //------------------------------------
bcostm 1:e9d1c42a73ae 7
bcostm 0:028fac66239d 8 Serial pc(SERIAL_TX, SERIAL_RX);
bcostm 2:08c13f9a3d5c 9
bcostm 0:028fac66239d 10 DigitalOut myled(LED1);
bcostm 2:08c13f9a3d5c 11
bcostm 2:08c13f9a3d5c 12 int main()
bcostm 2:08c13f9a3d5c 13 {
bcostm 2:08c13f9a3d5c 14 int i = 1;
bcostm 2:08c13f9a3d5c 15 pc.printf("Hello World !\n");
bcostm 2:08c13f9a3d5c 16 while(1) {
bcostm 2:08c13f9a3d5c 17 wait(1);
bcostm 2:08c13f9a3d5c 18 pc.printf("This program runs since %d seconds.\n", i++);
bcostm 2:08c13f9a3d5c 19 myled = !myled;
bcostm 2:08c13f9a3d5c 20 }
bcostm 0:028fac66239d 21 }