Lucas Neves
/
Minor_test_serial
Hello!
Fork of Minor_test_serial by
Revision 2:add4f29be23e, committed 2018-09-11
- Comitter:
- sacul276
- Date:
- Tue Sep 11 14:38:40 2018 +0000
- Parent:
- 1:40470bc517f1
- Commit message:
- Hello!
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 40470bc517f1 -r add4f29be23e main.cpp --- a/main.cpp Mon Sep 11 10:42:39 2017 +0000 +++ b/main.cpp Tue Sep 11 14:38:40 2018 +0000 @@ -1,19 +1,23 @@ #include "mbed.h" #include "MODSERIAL.h" -DigitalOut myled(LED_GREEN); -MODSERIAL pc(USBTX, USBRX); +DigitalOut myled(LED_GREEN); //[Information flow] Out: Board -> PC ; IN: PC -> Board +MODSERIAL pc(USBTX, USBRX); //Needed to use a screen --> PuTTY int main() { int i = 0; pc.baud(115200); pc.printf("Hello World!\r\n"); + + char c; + while (true) { wait(0.5f); // wait a small period of time pc.printf("%d \r\n", i); // print the value of variable i i++; // increment the variable myled = !myled; // toggle a led + c = pc.getc(); } }