Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of blip_dado by
Diff: main.cpp
- Revision:
- 0:60499ad28ea9
- Child:
- 1:ca76237d2965
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Jul 25 15:22:59 2014 +0000 @@ -0,0 +1,28 @@ +#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++; + } +}