takuya ichise
/
TI_NEOPIXEL_SPI_SAMPLE
Sample code for TI_NEOPIXEL_SPI
main.cpp@2:e91690a04f44, 2019-07-28 (annotated)
- Committer:
- tichise
- Date:
- Sun Jul 28 00:13:22 2019 +0000
- Revision:
- 2:e91690a04f44
- Parent:
- 0:601717e4c63e
- Child:
- 5:dc96362ec4d5
Compatible with large rings
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tichise | 0:601717e4c63e | 1 | #include "mbed.h" |
tichise | 0:601717e4c63e | 2 | #include "TI_NEOPIXEL_SPI.h" |
tichise | 0:601717e4c63e | 3 | |
tichise | 0:601717e4c63e | 4 | TI_NEOPIXEL_SPI pixelArray(p11); |
tichise | 0:601717e4c63e | 5 | |
tichise | 2:e91690a04f44 | 6 | int totalNumOfRingLED = 8+16+24+35; // 8+16+24+35 |
tichise | 2:e91690a04f44 | 7 | int startNumOfRingLED = 35+24; |
tichise | 2:e91690a04f44 | 8 | int endNumOfRingLED = 35+24+16; |
tichise | 0:601717e4c63e | 9 | |
tichise | 0:601717e4c63e | 10 | int main() |
tichise | 0:601717e4c63e | 11 | { |
tichise | 0:601717e4c63e | 12 | bool isRed = false; |
tichise | 0:601717e4c63e | 13 | |
tichise | 0:601717e4c63e | 14 | while(1) { |
tichise | 0:601717e4c63e | 15 | if (isRed) { |
tichise | 0:601717e4c63e | 16 | // pixelArray.switchLightOff(pixelCount); |
tichise | 2:e91690a04f44 | 17 | // pixelArray.changeColor(totalNumOfRingLED, startNumOfRingLED, endNumOfRingLED, (rgbColor) {50, 10, 170}); |
tichise | 2:e91690a04f44 | 18 | pixelArray.chaseRainbow(totalNumOfRingLED); |
tichise | 0:601717e4c63e | 19 | |
tichise | 0:601717e4c63e | 20 | } else { |
tichise | 2:e91690a04f44 | 21 | // rgbColor topColor = (rgbColor) {255, 0, 0}; |
tichise | 2:e91690a04f44 | 22 | // rgbColor bottomColor = (rgbColor) {0, 32, 255}; |
tichise | 0:601717e4c63e | 23 | |
tichise | 0:601717e4c63e | 24 | rgbColor circleColor = (rgbColor){50, 10, 170}; |
tichise | 2:e91690a04f44 | 25 | pixelArray.circle(totalNumOfRingLED, startNumOfRingLED, endNumOfRingLED, circleColor); |
tichise | 0:601717e4c63e | 26 | |
tichise | 2:e91690a04f44 | 27 | // pixelArray.switchLightOn(totalNumOfRingLED, startNumOfRingLED, endNumOfRingLED, pixelCount); |
tichise | 2:e91690a04f44 | 28 | // pixelArray.changeColor(totalNumOfRingLED, startNumOfRingLED, endNumOfRingLED, (rgbColor) {255, 255, 255}); |
tichise | 0:601717e4c63e | 29 | } |
tichise | 0:601717e4c63e | 30 | isRed = !isRed; |
tichise | 0:601717e4c63e | 31 | |
tichise | 0:601717e4c63e | 32 | wait(2); |
tichise | 0:601717e4c63e | 33 | } |
tichise | 0:601717e4c63e | 34 | } |