Use printf on the Nucleo board
main.cpp@0:899d0c9e6ff7, 2015-12-28 (annotated)
- Committer:
- sjallouli
- Date:
- Mon Dec 28 23:05:28 2015 +0000
- Revision:
- 0:899d0c9e6ff7
Use the printf on the Nucleo board
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sjallouli | 0:899d0c9e6ff7 | 1 | #include "mbed.h" |
sjallouli | 0:899d0c9e6ff7 | 2 | |
sjallouli | 0:899d0c9e6ff7 | 3 | //------------------------------------ |
sjallouli | 0:899d0c9e6ff7 | 4 | // Hyperterminal configuration |
sjallouli | 0:899d0c9e6ff7 | 5 | // 9600 bauds, 8-bit data, no parity |
sjallouli | 0:899d0c9e6ff7 | 6 | //------------------------------------ |
sjallouli | 0:899d0c9e6ff7 | 7 | |
sjallouli | 0:899d0c9e6ff7 | 8 | Serial pc(SERIAL_TX, SERIAL_RX); |
sjallouli | 0:899d0c9e6ff7 | 9 | DigitalOut myled(LED1); |
sjallouli | 0:899d0c9e6ff7 | 10 | |
sjallouli | 0:899d0c9e6ff7 | 11 | int main() |
sjallouli | 0:899d0c9e6ff7 | 12 | { |
sjallouli | 0:899d0c9e6ff7 | 13 | int i = 1; |
sjallouli | 0:899d0c9e6ff7 | 14 | pc.printf("Hello World !\r\n"); |
sjallouli | 0:899d0c9e6ff7 | 15 | |
sjallouli | 0:899d0c9e6ff7 | 16 | while(1) |
sjallouli | 0:899d0c9e6ff7 | 17 | { |
sjallouli | 0:899d0c9e6ff7 | 18 | wait(1); |
sjallouli | 0:899d0c9e6ff7 | 19 | pc.printf("This program runs since %d seconds.\r\n", i++); |
sjallouli | 0:899d0c9e6ff7 | 20 | myled = !myled; |
sjallouli | 0:899d0c9e6ff7 | 21 | } |
sjallouli | 0:899d0c9e6ff7 | 22 | } |
sjallouli | 0:899d0c9e6ff7 | 23 |