ABELI19_Stefan Schwarz
/
Lauftest
main
Revision 2:966a09f3c106, committed 2020-01-13
- Comitter:
- stefanblack
- Date:
- Mon Jan 13 17:49:40 2020 +0000
- Parent:
- 1:e15f803c8fe9
- Commit message:
- nibbleLeds()
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r e15f803c8fe9 -r 966a09f3c106 main.cpp --- a/main.cpp Mon Jan 13 17:28:08 2020 +0000 +++ b/main.cpp Mon Jan 13 17:49:40 2020 +0000 @@ -1,5 +1,6 @@ #include "mbed.h" +void printb(uint8_t x); void nibbleLeds(int value); BusOut myleds(LED1,LED2,LED3,LED4); @@ -13,10 +14,17 @@ uint8_t value=INIT; nibbleLeds(value); + printb(value); wait(0.1); } +void printb(uint8_t) +{ + for(int i=sizeof(x)<<3;i;i--) + putchar('0'+((x>>(i-1))&1)); + printf("\n"); + void nibbleLeds(int value) { myleds=value%16;