Rita Freudenberg
/
Nucleo_neopixel_ovgu3
Beispiel 2
Fork of Nucleo_neopixel_ovgu1 by
main.cpp@6:67eded37186e, 2017-12-12 (annotated)
- Committer:
- RitaF
- Date:
- Tue Dec 12 08:06:55 2017 +0000
- Revision:
- 6:67eded37186e
- Parent:
- 5:0993d55a871e
Beispiel 2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bcostm | 0:028fac66239d | 1 | #include "mbed.h" |
Hinz | 4:1f676d6961e8 | 2 | #include "neopixel.h" |
Hinz | 4:1f676d6961e8 | 3 | |
Hinz | 4:1f676d6961e8 | 4 | NeoPixel npx(D6,8); |
bcostm | 1:e9d1c42a73ae | 5 | |
RitaF | 6:67eded37186e | 6 | void setByte(uint8_t bits, uint32_t color) |
RitaF | 6:67eded37186e | 7 | { |
RitaF | 6:67eded37186e | 8 | for (int i=0; i<8; i++) |
RitaF | 6:67eded37186e | 9 | if (bits & 1 << i) |
RitaF | 6:67eded37186e | 10 | npx.setColor(i,color); |
RitaF | 6:67eded37186e | 11 | else |
RitaF | 6:67eded37186e | 12 | npx.setColor(i,0); |
RitaF | 6:67eded37186e | 13 | npx.show(); |
RitaF | 6:67eded37186e | 14 | } |
RitaF | 6:67eded37186e | 15 | |
Hinz | 4:1f676d6961e8 | 16 | int main() { |
RitaF | 6:67eded37186e | 17 | //binärer Zähler ;) |
bcostm | 0:028fac66239d | 18 | } |