LED Control with LPD8806 Library + Arduino

From ESE205 Wiki
Revision as of 21:26, 1 May 2017 by Hschoi (talk | contribs) (Created page with "==Getting Started== The LPD8806 library is used to control LPD8806/LPD8803/LPD8809 PWM LED driver chips, strips and pixels. The link for downloading and instructions for insta...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Getting Started

The LPD8806 library is used to control LPD8806/LPD8803/LPD8809 PWM LED driver chips, strips and pixels. The link for downloading and instructions for installing the library can be found here. [1]

Creating an instance of the LPD8806 class

The LPD8806 library has three constructors:

  • LPD8806(uint16_t n, uint8_t dpin, uint8_t cpin)
    

This constructor takes in the number of LEDs in the strip, the data pin (port on arduino connected to DI), and the clock pin (port on arduino connected to CI).

example:

LPD8806 strip1 = LPD8806(48, 51, 52)//creates an LPD8806 object to control 48 lights, with data pin on 51, and clock pin on 52
  • LPD8806(uint16_t n)
    

This constructor takes in the number of LEDs to control, and relies on the Arduino's hardware SPI. These pins vary for each Arduino, so make sure you have it connected to the right pins.

exsample:

LPD8806 strip1 = LPD8806(48)//creates an LPD8806 object with Arduino SPI pins, (ie, on the Arduino Mega, these pins are 51 for the data pin and 52 for the clock pin)
  • LPD8806()
    

This is a blank constructor, you must set the number of LEDs, data and clock pin separately using updatePins(uint8_t dpin, uint8_t cpin).