Lucas Neves
/
Minor_test_serial
Hello!
Fork of Minor_test_serial by
Diff: main.cpp
- Revision:
- 2:add4f29be23e
- Parent:
- 1:40470bc517f1
--- 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(); } }