This library lets you control the addressable RGB LED strips from Pololu Robotics & Electronics.

Dependents:   WoYaoChengGOng V2-WoYaoChengGOng STM32_MagneticLight tape_Led_Sample ... more

Embed: (wiki syntax)

« Back to documentation index

PololuLedStrip Class Reference

PololuLedStrip Class Reference

This class lets you control the addressable RGB LED strips from Pololu, or any other LED strip based on the TM1804 chip. More...

#include <PololuLedStrip.h>

Public Member Functions

 PololuLedStrip (PinName pin)
 This constructor lets you make an led strip object by specifying the pin name.
void write (rgb_color *colors, unsigned int count)
 Writes the specified series of colors to the LED strip.

Static Public Attributes

static bool interruptFriendly
 This option defaults to false.

Detailed Description

This class lets you control the addressable RGB LED strips from Pololu, or any other LED strip based on the TM1804 chip.

Definition at line 24 of file PololuLedStrip.h.


Constructor & Destructor Documentation

PololuLedStrip ( PinName  pin )

This constructor lets you make an led strip object by specifying the pin name.

There are no restrictions on what pin you can choose.

Example:

PololuLedStrip ledStrip(p8);

Member Function Documentation

void write ( rgb_color colors,
unsigned int  count 
)

Writes the specified series of colors to the LED strip.

Parameters:
colorsshould be a pointer to an array of rgb_color structs.
countshould be the number of colors to write.

The first color in the array will be written to the LED closest to the data input connector. To update all the LEDs in the LED strip, count should be equal to or greater than the number of LEDs in the strip. If count is less than the number of LEDs in the strip, then some LEDs near the end of the strip will not be updated.

The colors are sent in series and each color takes about 45 microseconds to send. This function disables interrupts temporarily while it is running. This function waits for over 10 us at the end before returning to allow the colors to take effect.


Field Documentation

bool interruptFriendly [static]

This option defaults to false.

Setting this to true changes the behavior of the write function, making it enable interrupts after each color is sent, about every 60 microseconds. This allows your program to respond to interrupts faster, but makes it possible for an interrupt that takes longer than 8 microseconds to screw up the transmission of colors to the LED strip.

Example:

Definition at line 65 of file PololuLedStrip.h.