Mirza Mesic
/
tinf_test_mesic_mirza_fertig
vollProgramm
Revision 4:6eb0d62c4fbf, committed 2020-01-13
- Comitter:
- mirzamesic
- Date:
- Mon Jan 13 17:42:09 2020 +0000
- Parent:
- 3:21631924f2f1
- Commit message:
- vollProgramm
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Jan 13 17:32:26 2020 +0000 +++ b/main.cpp Mon Jan 13 17:42:09 2020 +0000 @@ -1,6 +1,7 @@ #include "mbed.h" #define BUTTON1 p14 +int modifyBit(int x, unsigned char position, bool State); int lauflicht(bool richtung, int time, int &anz); void nibbleLeds(int value); void printb(uint8_t x); @@ -19,12 +20,26 @@ nibbleLeds(value); printb(value); + value = modifyBit(value,2,1); + printb(myleds); + printb(modifyBit(INIT,3,1)); wait(0.1); } +int modifyBit(int x,uint8_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; + uint8_t lauf = 0x01; if(!richtung)