Matt Koehler
/
interface
Test
Revision 0:2d62dff17821, committed 2016-09-30
- Comitter:
- Koeh_Matt
- Date:
- Fri Sep 30 22:10:50 2016 +0000
- Commit message:
- Twst
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 2d62dff17821 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Sep 30 22:10:50 2016 +0000 @@ -0,0 +1,47 @@ +#include "mbed.h" + +void toggle(DigitalOut &x); + +DigitalOut myled1(LED1); +DigitalOut myled2(LED2); +DigitalOut myled3(LED3); +DigitalOut myled4(LED4); + +Serial pc(USBTX, USBRX); + +int main() { + char c; + myled1 = 1; + myled2 = 1; + myled3 = 1; + myled4 = 1; + while(1) + { + while( (c = pc.getc()) != 'x' ) + { + switch(c) + { + case '1': + toggle(myled1); + break; + case '2': + toggle(myled2); + break; + case '3': + toggle(myled3); + break; + case '4': + toggle(myled4); + break; + } + } + } +} + +void toggle(DigitalOut &x) +{ + if(x.read() == 0) + x = 1; + else + x = 0; +} \ No newline at end of file
diff -r 000000000000 -r 2d62dff17821 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Sep 30 22:10:50 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/f141b2784e32 \ No newline at end of file