simple uart msg to test serial TX and Rx

Dependencies:   mbed

Committer:
Blackshark
Date:
Mon Sep 18 09:15:22 2017 +0000
Revision:
0:6069b7f740e4
simple uart

Who changed what in which revision?

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