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.

RGBRingCoder Class

Module: rgbringcoder

RGB RingCoder is a breakout board, a circular LED containing 16 LEDs arranged in a ring, and a rotary encoder. The encoder contains an RGB LED as well as a push button function.
The device requires 11 pins, 3 of which must be PWM-capable (for the RGB LEDs).
rgbringcoder.jpg

Methods

RGBRingCoder

(
  • en
  • latch
  • clear
  • clk
  • dat
  • sw
  • encA
  • encB
  • red
  • green
  • blue
)
Number

RGBRingCoder constructor

Parameters:

  • en Number

    Enables GPIO

  • latch Number

    Latch GPIO

  • clear Number

    Clears GPIO

  • clk Number

    Clock GPIO

  • dat Number

    Data out GPIO

  • sw Number

    Push button switch GPIO

  • encA Number

    Encoder A GPIO

  • encB Number

    Encoder B GPIO

  • red Number

    RGB red LED PWM

  • green Number

    RGB green LED PWM

  • blue Number

    RGB blue LED PWM

Returns:

Number:

setRingLEDS

(
  • bits
)

Parameters:

  • bits Number

    undefined

getButtonState

() Boolean

Returns the state of the button

Returns:

Boolean:

True if the button is pressed, false otherwise

getEncoderPosition

() Number

Returns:

Number:

clearEncoderPosition

()

Sets the encoder counter to 0

setRGBLED

(
  • r
  • g
  • b
)

Sets the intensity of the red, green, and blue LEDs. Values can be between 0.0 and 1.0. Lower is brighter, higher is dimmer.

Parameters:

  • r Number

    Red value; valid values are 0.0-1.0

  • g Number

    Green value; valid values are 0.0-1.0

  • b Number

    Blue value; valid values are 0.0-1.0