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.

MY9221 Class

Module: my9221

Methods

MY9221

(
  • dataPin
  • clockPin
  • instances
)
Number

Instantiates an MY9221 object

Parameters:

  • dataPin Number

    Data pin

  • clockPin Number

    Clock pin

  • instances Number

    Number of daisy-chained my9221s, default 1

Returns:

Number:

setAutoRefresh

(
  • enable
)

Enable or disable auto refresh. When auto refresh is enabled, update the LED display as soon as the internal state changes. When false, the display(s) will not be updated until the refresh() method is called.

Parameters:

  • enable Boolean

    true to enable auto refresh, false otherwise

setLED

(
  • led
  • on
)

Set an LED to a specific on (high intensity) or off (low intensity) value.

Parameters:

  • led Number

    The LED whose state you wish to change

  • on Boolean

    true to turn on the LED, false to turn the LED off

setLowIntensityValue

(
  • intensity
)

Set the greyscale intensity of an LED in the OFF state. The intensity is a value from 0 (fully off) to 255 (fully on). This will take effect on any future LED set or clear operations.

Parameters:

  • intensity Number

    a value from 0 (fully off) to 255 (fully on)

setHighIntensityValue

(
  • intensity
)

Set the greyscale intensity of an LED in the ON state. The intensity is a value from 0 (fully off) to 255 (fully on). This will take effect on any future LED set or clear operations.

Parameters:

  • intensity Number

    a value from 0 (fully off) to 255 (fully on)

setAll

()

Set all of the LEDS to the ON (high intensity value) state.

clearAll

()

Set all of the LEDS to the OFF (low intensity value) state.

refresh

()

Set the LED states to match the internal stored states. This is useful when auto refresh ( setAutoRefresh() ) is false to update the display.