Rita Freudenberg
/
Nucleo_neopixel_ovgu3
Beispiel 2
Fork of Nucleo_neopixel_ovgu1 by
Diff: main.cpp
- Revision:
- 6:67eded37186e
- Parent:
- 5:0993d55a871e
--- a/main.cpp Mon Dec 11 17:07:35 2017 +0000 +++ b/main.cpp Tue Dec 12 08:06:55 2017 +0000 @@ -3,16 +3,16 @@ NeoPixel npx(D6,8); +void setByte(uint8_t bits, uint32_t color) +{ + for (int i=0; i<8; i++) + if (bits & 1 << i) + npx.setColor(i,color); + else + npx.setColor(i,0); + npx.show(); +} + int main() { - - npx.setColor(0,0x550000); - npx.setColor(1,0x005500); - npx.setColor(2,0x000055); - npx.setColor(3,0x555500); - npx.setColor(4,0x005555); - npx.setColor(5,0x550055); - npx.setColor(6,0xffffff); - npx.setColor(7,0x1f1f1f); - npx.show(); - + //binärer Zähler ;) }