Sample code for TI_NEOPIXEL_SPI

Dependencies:   TI_NEOPIXEL_SPI

main.cpp

Committer:
tichise
Date:
17 months ago
Revision:
5:dc96362ec4d5
Parent:
2:e91690a04f44

File content as of revision 5:dc96362ec4d5:

#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});
            
            int buffer = 4;
            pixelArray.chaseRainbow(totalNumOfRingLED, buffer);

        } 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);
    }
}