This is an example program for the PololuLedStrip library. It generates a simple moving gradient pattern.
Dependencies: PololuLedStrip mbed LedStripGradient
Dependents: LedStripGradient led_phare_crf
For more information, see the PololuLedStrip library.
main.cpp
- Committer:
- DavidEGrayson
- Date:
- 2017-11-01
- Revision:
- 16:66404dec28db
- Parent:
- 14:deec0e9c10a4
File content as of revision 16:66404dec28db:
#include "mbed.h"
#include "PololuLedStrip.h"
PololuLedStrip ledStrip(D8);
#define LED_COUNT 60
rgb_color colors[LED_COUNT];
Timer timer;
int main()
{
timer.start();
while(1)
{
// Update the colors array.
uint8_t time = timer.read_ms() >> 2;
for(uint32_t i = 0; i < LED_COUNT; i++)
{
uint8_t x = time - 8*i;
colors[i] = (rgb_color){ x, 255 - x, x };
}
// Send the colors to the LED strip.
ledStrip.write(colors, LED_COUNT);
wait_ms(10);
}
}
David Grayson
Pololu Addressable RGB LED Strip