![](/media/cache/profiles/36388716_10156379864393903_5314622498057224192_n.jpg.50x50_q85.jpg)
Sample code for TI_NEOPIXEL_SPI
main.cpp
- Committer:
- tichise
- Date:
- 2019-07-28
- Revision:
- 2:e91690a04f44
- Parent:
- 0:601717e4c63e
- Child:
- 5:dc96362ec4d5
File content as of revision 2:e91690a04f44:
#include "mbed.h" #include "TI_NEOPIXEL_SPI.h" TI_NEOPIXEL_SPI pixelArray(p11); int totalNumOfRingLED = 8+16+24+35; // 8+16+24+35 int startNumOfRingLED = 35+24; int endNumOfRingLED = 35+24+16; int main() { bool isRed = false; while(1) { if (isRed) { // pixelArray.switchLightOff(pixelCount); // pixelArray.changeColor(totalNumOfRingLED, startNumOfRingLED, endNumOfRingLED, (rgbColor) {50, 10, 170}); pixelArray.chaseRainbow(totalNumOfRingLED); } else { // rgbColor topColor = (rgbColor) {255, 0, 0}; // rgbColor bottomColor = (rgbColor) {0, 32, 255}; rgbColor circleColor = (rgbColor){50, 10, 170}; pixelArray.circle(totalNumOfRingLED, startNumOfRingLED, endNumOfRingLED, circleColor); // pixelArray.switchLightOn(totalNumOfRingLED, startNumOfRingLED, endNumOfRingLED, pixelCount); // pixelArray.changeColor(totalNumOfRingLED, startNumOfRingLED, endNumOfRingLED, (rgbColor) {255, 255, 255}); } isRed = !isRed; wait(2); } }