Mao jesephin
/
LaufTest
test
Diff: main.cpp
- Revision:
- 10:4e627d84406c
- Parent:
- 9:c2c6a6a50c14
--- a/main.cpp Mon Jan 13 18:10:08 2020 +0000 +++ b/main.cpp Mon Jan 13 18:13:12 2020 +0000 @@ -28,37 +28,16 @@ wait(0.1); } - - void nibbleLeds(int value) - { - myleds=value%16; - } - - void printb(uint8_t x) - { - for(int i=sizeof(x)<<3;i;i--) - putchar('0')+((x>>(i-1)&1)); - printf("\n"); - } - - int modifyBit(int x, unit8_t position, bool State) - { - int mask = 1 << position; - int state = int(State); - return(x&~mask)|((state<<position)&mask); - } - - int lauflicht(bool richtung,int time,int&anz) { int i; - unit8_t lauf=0x01; + uint8_t lauf=0x01; if(!richtung) lauf=0x08; while(1) { - nibbleLeds(lauf&0x0F); + nibbbleLeds(lauf&0x0F); if(richtung) { lauf=lauf<<1; @@ -77,7 +56,23 @@ } return anz; } -} + + void printb(uint8_t x) + { + for(int i=sizeof(x)<<3;i;i--) + putchar('0')+((x>>(i-1)&1)); + printf("\n"); + } + + int modifyBit(int x, unit8_t position, bool State) + { + int mask = 1 << position; + int state = int(State); + return(x&~mask)|((state<<position)&mask); + } + + + void nibbleLeds(int value) {