Santiago Escobar
/
frdm_serial
XD
main.cpp@0:00f775075856, 2020-05-01 (annotated)
- Committer:
- SantiagoE
- Date:
- Fri May 01 19:43:50 2020 +0000
- Revision:
- 0:00f775075856
Mbed Ejemplo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
SantiagoE | 0:00f775075856 | 1 | #include "mbed.h" |
SantiagoE | 0:00f775075856 | 2 | |
SantiagoE | 0:00f775075856 | 3 | DigitalOut myled(LED_GREEN); |
SantiagoE | 0:00f775075856 | 4 | Serial pc(USBTX, USBRX); |
SantiagoE | 0:00f775075856 | 5 | |
SantiagoE | 0:00f775075856 | 6 | int main() |
SantiagoE | 0:00f775075856 | 7 | { |
SantiagoE | 0:00f775075856 | 8 | int i = 0; |
SantiagoE | 0:00f775075856 | 9 | pc.baud(9600); |
SantiagoE | 0:00f775075856 | 10 | pc.printf("Hello World!\n"); |
SantiagoE | 0:00f775075856 | 11 | |
SantiagoE | 0:00f775075856 | 12 | while (true) { |
SantiagoE | 0:00f775075856 | 13 | wait(0.5f); // wait a small period of time |
SantiagoE | 0:00f775075856 | 14 | pc.printf("%d \n", i); // print the value of variable i |
SantiagoE | 0:00f775075856 | 15 | i++; // increment the variable |
SantiagoE | 0:00f775075856 | 16 | myled = !myled; // toggle a led |
SantiagoE | 0:00f775075856 | 17 | } |
SantiagoE | 0:00f775075856 | 18 | } |