UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

P9813 Class

Module: p9813

P9813 LED controller provides individually controllable LEDs through a two pin protocol For each LED, an RGB (0-255) value can be set.
p9813.jpg

Methods

P9813

(
  • ledCount
  • clkPin
  • dataPin
  • batchMode
)
Number

Instantiates a new P9813 LED chain

Parameters:

  • ledCount Number

    Number of P9813 leds in the chain

  • clkPin Number

    Clock Pin

  • dataPin Number

    Data Pin

  • batchMode Boolean

    (optional) Immediately write to the LED controllers (false, default) or wait for a pushState call (true)

Returns:

Number:

setLed

(
  • ledIdx
  • r
  • g
  • b
)

Set the color for a single LED

Parameters:

  • ledIdx Number

    Index of the LED in the chain (0 based)

  • r Number

    Red component (0-255)

  • g Number

    Green component (0-255)

  • b Number

    Blue component (0-255)

setAllLeds

(
  • r
  • g
  • b
)

Set the color for all LEDs

Parameters:

  • r Number

    Red component (0-255)

  • g Number

    Green component (0-255)

  • b Number

    Blue component (0-255)

setLeds

(
  • startIdx
  • endIdx
  • r
  • g
  • b
)

Set the color for a range of LEDs

Parameters:

  • startIdx Number

    Start index of the range of LEDs in the chain (0 based)

  • endIdx Number

    End index of the range of LEDs in the chain (0 based)

  • r Number

    Red component (0-255)

  • g Number

    Green component (0-255)

  • b Number

    Blue component (0-255)

setLeds

(
  • startIdx
  • endIdx
  • colors
)

(Advanced) Manually control the colors and brightness of a range of LEDS Best used to maximize performance

Parameters:

  • startIdx Number

    Start index of the range of LEDs to update (0 based)

  • endIdx Number

    End index of the range of LEDs to update (0 based)

  • colors Std::vector RgbColor

    Vector containing RgbColor structures for each LED No check done on the boundaries

pushState

()

Outputs the current LED data to the LED controllers Note: Only required if batch mode is set to TRUE