Matthias Reichstam
/
Interrups_TINF
Interrups_TINF
Revision 0:0a60892ea9de, committed 2018-11-15
- Comitter:
- Reichi19
- Date:
- Thu Nov 15 17:12:51 2018 +0000
- Commit message:
- Interrups
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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Nov 15 17:12:51 2018 +0000 @@ -0,0 +1,50 @@ +#include "mbed.h" + +#define UP 1 +#define DOWN 2 +#define STOP 0 + +InterruptIn iiCenter(p14); +InterruptIn iiDown(p12); +InterruptIn iiUp(p15); +InterruptIn iiLeft(p13); +InterruptIn iiRight(p16); +BusOut doLeds(LED1,LED2,LED3,LED4); +float delay = 0.5; +char countDown = STOP; + +void swOff() { + doLeds = 0; + countDown = STOP; +} +void slow() { + delay = 0.5; +} +void fast() { + delay = 0.25; +} +void cUp() { + countDown = UP; +} +void cDown() { + countDown = DOWN; +} + +int main() +{ + doLeds = 0; + iiCenter.rise(&swOff); + iiLeft.rise(&slow); + iiRight.fall(&fast); + iiDown.rise(&cDown); + iiUp.rise(&cUp); + + while(1) { + if (countDown == DOWN) + doLeds = doLeds -1; + else if (countDown == UP) + doLeds = doLeds +1; + + wait(delay); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Nov 15 17:12:51 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/7130f322cb7e \ No newline at end of file