Jimmy Fang
/
TEST_Uart_0724
Uart
main.cpp@0:5247a0d085a8, 2019-07-24 (annotated)
- Committer:
- jimmy4399
- Date:
- Wed Jul 24 01:36:43 2019 +0000
- Revision:
- 0:5247a0d085a8
Uart
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jimmy4399 | 0:5247a0d085a8 | 1 | #include "mbed.h" |
jimmy4399 | 0:5247a0d085a8 | 2 | |
jimmy4399 | 0:5247a0d085a8 | 3 | //------------------------------------ |
jimmy4399 | 0:5247a0d085a8 | 4 | // Hyperterminal configuration |
jimmy4399 | 0:5247a0d085a8 | 5 | // 9600 bauds, 8-bit data, no parity |
jimmy4399 | 0:5247a0d085a8 | 6 | //------------------------------------ |
jimmy4399 | 0:5247a0d085a8 | 7 | |
jimmy4399 | 0:5247a0d085a8 | 8 | Serial pc(SERIAL_TX, SERIAL_RX); |
jimmy4399 | 0:5247a0d085a8 | 9 | |
jimmy4399 | 0:5247a0d085a8 | 10 | DigitalOut myled(LED1); |
jimmy4399 | 0:5247a0d085a8 | 11 | |
jimmy4399 | 0:5247a0d085a8 | 12 | int main() |
jimmy4399 | 0:5247a0d085a8 | 13 | { |
jimmy4399 | 0:5247a0d085a8 | 14 | int i = 1; |
jimmy4399 | 0:5247a0d085a8 | 15 | pc.printf("Hello World !\n"); |
jimmy4399 | 0:5247a0d085a8 | 16 | while(1) { |
jimmy4399 | 0:5247a0d085a8 | 17 | wait(1); |
jimmy4399 | 0:5247a0d085a8 | 18 | pc.printf("This program runs since %d seconds.\n", i++); |
jimmy4399 | 0:5247a0d085a8 | 19 | myled = !myled; |
jimmy4399 | 0:5247a0d085a8 | 20 | } |
jimmy4399 | 0:5247a0d085a8 | 21 | } |