Demo for Serial Comms
Dependencies: mbed
Fork of frdm_serial by
main.cpp@7:986d5298b118, 2014-07-16 (annotated)
- Committer:
- sam_grove
- Date:
- Wed Jul 16 09:59:53 2014 +0000
- Revision:
- 7:986d5298b118
- Parent:
- 4:d6816f97e349
update formatting, comments and mbed library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 0:f59179afee57 | 1 | #include "mbed.h" |
emilmont | 0:f59179afee57 | 2 | |
emilmont | 0:f59179afee57 | 3 | DigitalOut myled(LED_GREEN); |
Kojto | 4:d6816f97e349 | 4 | Serial pc(USBTX, USBRX); |
emilmont | 0:f59179afee57 | 5 | |
sam_grove | 7:986d5298b118 | 6 | int main() |
sam_grove | 7:986d5298b118 | 7 | { |
Kojto | 4:d6816f97e349 | 8 | int i = 0; |
sam_grove | 7:986d5298b118 | 9 | pc.printf("Hello World!\n"); |
sam_grove | 7:986d5298b118 | 10 | |
emilmont | 1:32eacc4f6beb | 11 | while (true) { |
sam_grove | 7:986d5298b118 | 12 | wait(0.5f); // wait a small period of time |
sam_grove | 7:986d5298b118 | 13 | pc.printf("%d \n", i); // print the value of variable i |
sam_grove | 7:986d5298b118 | 14 | i++; // increment the variable |
sam_grove | 7:986d5298b118 | 15 | myled = !myled; // toggle a led |
emilmont | 0:f59179afee57 | 16 | } |
emilmont | 0:f59179afee57 | 17 | } |