![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
test program
Diff: main.cpp
- Revision:
- 2:3875bc678188
- Parent:
- 1:899bf4117ea9
- Child:
- 3:ff2ce4f4c5cf
--- a/main.cpp Mon Jan 13 17:30:06 2020 +0000 +++ b/main.cpp Mon Jan 13 17:35:38 2020 +0000 @@ -3,6 +3,7 @@ // #define BUTTON1 A1 //NUCLEO: Taster A1 void nibbleLeds(int value); +void printb(uint8_t x); BusOut myleds(LED1, LED2, LED3, LED4); DigitalIn button(BUTTON1); @@ -14,10 +15,16 @@ uint8_t value = INIT; nibbleLeds(value); + printb(value); wait(0.1); } +void printb(uint8_t x) { + for(int i=sizeof(x)<<3; i; i--) + putchar('0'+((x<<(i-1))&1)); + } + void nibbleLeds(int value) { myleds = value%16; } \ No newline at end of file