Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Nucleo_neopixel_ovgu1 by
Revision 6:67eded37186e, committed 2017-12-12
- Comitter:
- RitaF
- Date:
- Tue Dec 12 08:06:55 2017 +0000
- Parent:
- 5:0993d55a871e
- Commit message:
- Beispiel 2
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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 ;) }