Luuk Blaauw
/
Lampje_kleuren
Lamp kleuren aansturen (werkt nog niet helemaal)
Revision 0:fc7212e4505a, committed 2016-09-15
- Comitter:
- luukblaauw
- Date:
- Thu Sep 15 16:17:59 2016 +0000
- Commit message:
- Werkt nog niet helemaal
Changed in this revision
diff -r 000000000000 -r fc7212e4505a MODSERIAL.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MODSERIAL.lib Thu Sep 15 16:17:59 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Sissors/code/MODSERIAL/#4737f8a5b018
diff -r 000000000000 -r fc7212e4505a main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Sep 15 16:17:59 2016 +0000 @@ -0,0 +1,52 @@ +#include "mbed.h" +#include "MODSERIAL.h" + +DigitalOut rood(LED_RED); +DigitalOut groen(LED_GREEN); +DigitalOut blauw(LED_BLUE); +MODSERIAL pc(USBTX,USBRX); + +int main() +{ + pc.baud(9600); + pc.printf("Hello World/r/n"); + + rood = 1; + groen = 1; + blauw = 1; + + while (true) + { + char c = pc.getc(); + if (c == 'r') + { + groen = 1; + blauw = 1; + while (true) + { + rood = !rood; + wait(0.2f); + }; + } + else if (c == 'g') + { + rood = 1; + blauw = 1; + while (true) + { + groen = !groen; + wait(0.2f); + }; + } + else if (c == 'b') + { + rood = 1; + groen = 1; + while (true) + { + blauw = !blauw; + wait(0.2f); + }; + }; + }; +} \ No newline at end of file
diff -r 000000000000 -r fc7212e4505a mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Sep 15 16:17:59 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/2e9cc70d1897 \ No newline at end of file