cy liang
/
blip_rainbow_mbed-os
blip_rainbow for Mbed OS 5.x
main.cpp
- Committer:
- JacobBramley
- Date:
- 2014-07-25
- Revision:
- 0:60499ad28ea9
- Child:
- 1:ca76237d2965
File content as of revision 0:60499ad28ea9:
#include "mbed.h" #include "neopixel-spi.h" // A backing store for the pixel data. static size_t const count = 16; neopixel::Pixel pixels[count]; // The pixel array control class. neopixel::Array array(p30); uint8_t IntensityForIndex(size_t index) { uint32_t c = index % 512; return (c >= 256) ? (256 - c) : c; } int main() { size_t offset = 0; while (1) { for (size_t i = 0; i < count; i++) { pixels[i].red = IntensityForIndex((i * 10) + offset); pixels[i].green = IntensityForIndex((i * 20) + offset); pixels[i].blue = IntensityForIndex((i * 40) + offset); } array.Update(pixels, count); wait_ms(10); offset++; } }