
Gewoon assignment 5 testen
Fork of Minor_test_serial by
Diff: main.cpp
- Revision:
- 2:2c4327bb230a
- Parent:
- 1:40470bc517f1
- Child:
- 3:c118f868d808
--- a/main.cpp Mon Sep 11 10:42:39 2017 +0000 +++ b/main.cpp Tue Sep 11 13:50:40 2018 +0000 @@ -3,17 +3,20 @@ DigitalOut myled(LED_GREEN); MODSERIAL pc(USBTX, USBRX); +char c; + + int main() { - int i = 0; + while (true){ + c = pc.getc(); pc.baud(115200); - pc.printf("Hello World!\r\n"); + pc.printf("%c\n",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 + + wait(0.5f); // wait a small period of time myled = !myled; // toggle a led + } }