Sandro Djuric
/
Test1_SandroDjuric
funktionen
Diff: main.cpp
- Revision:
- 4:25e070866cf0
- Parent:
- 3:57ccaba4a24d
- Child:
- 5:0b09788019ab
diff -r 57ccaba4a24d -r 25e070866cf0 main.cpp --- a/main.cpp Mon Jan 13 17:12:22 2020 +0000 +++ b/main.cpp Mon Jan 13 17:17:30 2020 +0000 @@ -22,4 +22,31 @@ int mask = 1 << position; int state = int(State); return (x & ~mask)|((state << position) & mask); -} \ No newline at end of file +} + +int lauflicht(bool richtung, int time, int &anz) +{ + int i; + uint8_t lauf = 0x01; + + if(!richtung) + lauf = 0x08; + while(1){ + nibbleLeds(lauf&0x0F); + if(richtung){ + lauf = lauf<<1; + if(lauf>8) + lauf=0x01; + } + else{ + lauf=lauf >> 1; + if(lauf==0) + lauf=0x08; + } + if(button) + break; + wait_ms(time); + anz++; + } + return anz; + } \ No newline at end of file