Sample code for TI_NEOPIXEL

Dependencies:   mbed

Committer:
tichise
Date:
Sat Jul 21 06:46:04 2018 +0000
Revision:
0:4a27f777203a
new

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tichise 0:4a27f777203a 1 #include "mbed.h"
tichise 0:4a27f777203a 2 #include "TI_NEOPIXEL.h"
tichise 0:4a27f777203a 3
tichise 0:4a27f777203a 4 TI_NEOPIXEL neopixel(p11);
tichise 0:4a27f777203a 5
tichise 0:4a27f777203a 6 int main()
tichise 0:4a27f777203a 7 {
tichise 0:4a27f777203a 8 bool isRed = false;
tichise 0:4a27f777203a 9
tichise 0:4a27f777203a 10 while(1) {
tichise 0:4a27f777203a 11 if (isRed) {
tichise 0:4a27f777203a 12 // neopixel.switchLightOff(16);
tichise 0:4a27f777203a 13 // neopixel.changeColor(16, (rgb_color) {50, 10, 170});
tichise 0:4a27f777203a 14 neopixel.circleRainbow(16);
tichise 0:4a27f777203a 15
tichise 0:4a27f777203a 16 } else {
tichise 0:4a27f777203a 17 rgb_color topColor = (rgb_color) {255, 0, 0};
tichise 0:4a27f777203a 18 rgb_color bottomColor = (rgb_color) {0, 32, 255};
tichise 0:4a27f777203a 19 neopixel.changePointColor(16, topColor, bottomColor);
tichise 0:4a27f777203a 20
tichise 0:4a27f777203a 21 /*
tichise 0:4a27f777203a 22 rgb_color circleColor = (rgb_color){50, 10, 170};
tichise 0:4a27f777203a 23 neopixel.circle(16, circleColor);
tichise 0:4a27f777203a 24 */
tichise 0:4a27f777203a 25
tichise 0:4a27f777203a 26 // neopixel.switchLightOn(16);
tichise 0:4a27f777203a 27 // neopixel.changeColor(16, (rgb_color) {255, 255, 255});
tichise 0:4a27f777203a 28 }
tichise 0:4a27f777203a 29 isRed = !isRed;
tichise 0:4a27f777203a 30
tichise 0:4a27f777203a 31 wait(2);
tichise 0:4a27f777203a 32 }
tichise 0:4a27f777203a 33 }