USBSerial Hello World
Fork of USBSerial_HelloWorld by
USBSerial Hello world example code.
main.cpp@10:d74aaa6c1f4e, 2018-08-07 (annotated)
- Committer:
- MACRUM
- Date:
- Tue Aug 07 15:56:53 2018 +0000
- Revision:
- 10:d74aaa6c1f4e
- Parent:
- 9:d88699a0905a
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
samux | 7:5e693654d5b4 | 1 | #include "mbed.h" |
samux | 7:5e693654d5b4 | 2 | #include "USBSerial.h" |
samux | 7:5e693654d5b4 | 3 | |
MACRUM | 10:d74aaa6c1f4e | 4 | USBSerial serial; // 9600 bps |
MACRUM | 10:d74aaa6c1f4e | 5 | DigitalOut led(LED1); |
MACRUM | 10:d74aaa6c1f4e | 6 | |
samux | 7:5e693654d5b4 | 7 | int main(void) { |
MACRUM | 10:d74aaa6c1f4e | 8 | |
MACRUM | 10:d74aaa6c1f4e | 9 | int count = 0; |
MACRUM | 10:d74aaa6c1f4e | 10 | serial.printf("Hello, Mbed world.\n\n"); |
samux | 7:5e693654d5b4 | 11 | while(1) |
samux | 7:5e693654d5b4 | 12 | { |
MACRUM | 10:d74aaa6c1f4e | 13 | led = !led; |
MACRUM | 10:d74aaa6c1f4e | 14 | serial.printf("count = %d\n", count++); |
MACRUM | 10:d74aaa6c1f4e | 15 | wait(0.5); |
samux | 7:5e693654d5b4 | 16 | } |
samux | 7:5e693654d5b4 | 17 | } |