Prototype
Dependencies: mbed ButtonEventDemo
Revision 17:080847c64d0b, committed 2020-01-13
- Comitter:
- Kelrath1984
- Date:
- Mon Jan 13 18:12:09 2020 +0000
- Parent:
- 16:acf89f757b1b
- Commit message:
- Noch zu debuggen aber alles drinnen
Changed in this revision
Lauflicht.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r acf89f757b1b -r 080847c64d0b Lauflicht.cpp --- a/Lauflicht.cpp Mon Jan 13 17:58:06 2020 +0000 +++ b/Lauflicht.cpp Mon Jan 13 18:12:09 2020 +0000 @@ -16,9 +16,13 @@ uint8_t value=INIT; int anzahl, anz; + anzahl=lauflicht(0,400,anz=0); + printf("anzahl= %d\n", anzahl); nibbleLeds(value); printb(value); + value=modifyBit(value,2,1); printb(myleds); + printb(modifyBit(INIT,3,1)); lauflicht(0,400,anz=0); wait(0.1); } @@ -54,6 +58,12 @@ return anz; } +int modifyBit(int x, uint8_t position, bool State){ + int mask=1<<position; + int state =int(State); + return (x&~mask)|((state<<position)&mask); +} + void printb(uint8_t x){ for(int i=sizeof(x)<<3; i; i--){ putchar('0'+((x>>(i-1))&1));