Rita Freudenberg
/
Nucleo_neopixel_ovgu1
Beispiel1
Fork of Nucleo_neopixel_ovgu by
Revision 5:0993d55a871e, committed 2017-12-11
- Comitter:
- RitaF
- Date:
- Mon Dec 11 17:07:35 2017 +0000
- Parent:
- 4:1f676d6961e8
- Commit message:
- erstes Beispiel
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 1f676d6961e8 -r 0993d55a871e main.cpp --- a/main.cpp Mon Dec 11 12:55:19 2017 +0000 +++ b/main.cpp Mon Dec 11 17:07:35 2017 +0000 @@ -3,43 +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() { - int i; - for (i=0; i<8; i++) - npx.setColor(i,0x00ff00); - npx.show(); - wait(5.0); - - npx.setColor(0,0xff0000); - npx.setColor(1,0x00ff00); - npx.setColor(2,0x0000ff); - npx.setColor(3,0xffff00); - npx.setColor(4,0x00ffff); - npx.setColor(5,0xff00ff); + 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(); - wait(5.0); - - char* text = "INFORMATIK"; - - while(*text) { - setByte(*text++,0xff0000); - wait(1.0); - } - }