Christian Weiß
/
TINF_Test2
TINF_Test2
Revision 0:39df3b292863, committed 2018-11-15
- Comitter:
- Wizo
- Date:
- Thu Nov 15 18:10:21 2018 +0000
- Commit message:
- TINF_Test2
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 18:10:21 2018 +0000 @@ -0,0 +1,85 @@ +#include "mbed.h" + + +int zaehler = 7; + +InterruptIn JsUp(p15); +InterruptIn JsDown(p12); +InterruptIn JsLeft(p13); +InterruptIn JsRight(p16); +InterruptIn JsCenter(p14); +BusOut myLed(LED1, LED2, LED3, LED4); + +void plus1() +{ + if(zaehler <= 30) + zaehler += 1; + + wait(0.25); +} +void plus5() +{ + if(zaehler <= 30) + zaehler += 5; + + wait(0.25); +} +void minus1() +{ + if(zaehler >= -20) + zaehler -= 1; + + wait(0.25); +} +void minus5() +{ + if(zaehler >= -20) + zaehler -= 5; + + wait(0.25); +} +void Zaehlerstand() +{ + printf("Zaehlerstand = %d\n", zaehler); + wait(0.25); +} +int main() { + + JsUp.rise(&plus1); + JsDown.rise(&plus5); + JsLeft.fall(&minus1); + JsRight.fall(&minus5); + + JsCenter.rise(&Zaehlerstand); + + printf("BULME: Joystick-Zaehler ++++++ 29.01.2018 ++++++ Christian Weiss\n"); + + + + while(1) + { + if(zaehler <= 30 && zaehler >= -20) + { + myLed = 6; + } + else if(zaehler > 30) + { + myLed = 12; + wait(0.2); + myLed = 0; + wait(0.2); + } + else if(zaehler < -20) + { + myLed = 3; + wait(0.5); + myLed = 0; + wait(0.5); + } + + + } +} + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Nov 15 18:10:21 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/7130f322cb7e \ No newline at end of file