Stefan Simbürger
/
04_TINF_Interrupt
Interrupt Spielereien
main.cpp
- Committer:
- Ursukar
- Date:
- 2019-12-02
- Revision:
- 0:9db80233bfe2
- Child:
- 1:c880c990b9b9
File content as of revision 0:9db80233bfe2:
#include "mbed.h" //Alle Buttons am Joystick definieren DigitalIn ButtonDown(p12); DigitalIn ButtonLeft(p13); DigitalIn ButtonCenter(p14); DigitalIn ButtonUp(p15); DigitalIn ButtonRight(p16); BusOut myleds(LED1, LED2, LED3, LED4); void Reset(uint8_t mask); void bitLeft(); /* void print_binary(uint8_t x) { // function to print binary for(int i=sizeof(x)<<3; i; i--) putchar('0'+((x>>(i-1))&1)); }*/ int main() { uint8_t mask = 0b00001111; //bool lastButtonstate; while(1) { if(ButtonCenter) { Reset(mask); } if(ButtonLeft) { bitLeft(); } } } void Reset(uint8_t mask) { myleds = mask; } void bitLeft() { myleds = myleds << 1; wait_ms(500); }