You can write text with this programm.
Fork of Minor_test_serial by
Diff: main.cpp
- Revision:
- 2:4ffe049e7231
- Parent:
- 1:26ce7013f2c5
--- a/main.cpp Mon Sep 12 10:14:01 2016 +0000 +++ b/main.cpp Mon Sep 12 10:34:25 2016 +0000 @@ -1,9 +1,17 @@ #include "mbed.h" #include "MODSERIAL.h" -DigitalOut myled(LED_GREEN); +DigitalOut grled(LED_GREEN); +DigitalOut rdled(LED_RED); +DigitalOut blled(LED_BLUE); MODSERIAL pc(USBTX, USBRX); char c; +int Ticker; + +void ticking(bool& a) +{ + a = !a; +} int main() { @@ -15,8 +23,24 @@ { c = pc.getc(); pc.printf("%c", c); // print the value of variable i - i++; // increment the variable - myled = !myled; // toggle a led + switch (c) + { + case 'r' : + rdled = false; + grled = true; + blled = true; + break; + case 'b' : + rdled = true; + grled = true; + blled = false; + break; + case 'g' : + rdled = true; + grled = false; + blled = true; + break; + } wait(0.1f); } }