Maida Ahmic
/
LaufTest
test programm
Diff: main.cpp
- Revision:
- 5:630756c3af86
- Parent:
- 4:3af6714f01d6
--- a/main.cpp Mon Jan 13 17:50:53 2020 +0000 +++ b/main.cpp Mon Jan 13 18:03:21 2020 +0000 @@ -3,8 +3,8 @@ #define BUTTON1 P14 // M3:push joystick pin #define BUTTON1 A1 //NUCLEO:Taster A1 -//int modifyBit(int x,unsigned char position,bool State); -//int lauflicht(bool richtung,int time,int &anz); +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,8 +19,14 @@ int anzahl,anz; uint8_t value=INIT; + anzahl=lauflicht(true,400,anz=0); + printf("anzahl=%d\n",anzahl); + nibbleLeds(value); printb(value); + value=modifyBit(value,2,1); + printb(myleds); + printb(modifyBit(INIT,3,1)); wait(0.1); } @@ -61,13 +67,12 @@ } - - void printb(uint8_t x) { for(int i=sizeof(x)<<3;i;i--) putchar('0'+((x>>(i-1))&1)); printf("\n"); } + void nibbleLeds(int value) { myleds=value%16; } \ No newline at end of file