Martin Werluschnig
/
CountUpDownChangSpeed
Revision 0:074559f65d33, committed 2018-11-15
- Comitter:
- martwerl
- Date:
- Thu Nov 15 17:58:16 2018 +0000
- Commit message:
- CountUpDownChangSpeed
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 074559f65d33 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Nov 15 17:58:16 2018 +0000 @@ -0,0 +1,38 @@ +#include "mbed.h" + +InterruptIn iiCenter(p14); +DigitalIn diDown(p12); +DigitalIn diLeft(p13); +DigitalIn diRight(p16); + +BusOut doLeds(LED1,LED2,LED3,LED4); + +void swoff() +{ + doLeds = 0; +} +int main() +{ + float delay = 0.5; + + doLeds = 0; + iiCenter.rise(&swoff); + while(1) + { + if (diDown) { + doLeds = doLeds -1; + } + else + doLeds = doLeds +1; + + if (diRight ==1) + delay = 0.25; + if (diLeft ==1) + delay = 0.5; + + if (iiCenter) + doLeds = 0; + + wait(delay); + } +}
diff -r 000000000000 -r 074559f65d33 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Nov 15 17:58:16 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/7130f322cb7e \ No newline at end of file