Christian Weiß
/
TINF_Test
TINF_Test
main.cpp
- Committer:
- Wizo
- Date:
- 2018-11-15
- Revision:
- 0:6c46858f4ced
File content as of revision 0:6c46858f4ced:
#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); 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"); 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); } } } 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", zaehler); wait(0.25); }