pyupm_my9221 module

class pyupm_my9221.GroveCircularLED(dataPin, clockPin)[source]

Bases: pyupm_my9221.MY9221

API for the Grove Circular LED module.

ID: grovecircularled

Name: Circular LED

Category: display

Manufacturer: seeed

Link:http://www.seeedstudio.com/wiki/Grove_-_Circular_LED

Connection: gpio This is a circular LED ring based on the MY9221 chip. It is often used with a rotary encoder and has 24 controllable LEDs.

C++ includes: grovecircularled.hpp

setLevel(level, direction=True)[source]

void setLevel(uint8_t level, bool direction=true)

Sets the lighting status

level: Selected level for the circular LED (0-23)

direction: Up or down; up is true and default

setSpinner(position)[source]

void setSpinner(uint8_t position)

Sets the spinner (turns off all LEDs but selected one)

position: Selected position for the spinner (0-23)

class pyupm_my9221.GroveLEDBar(dataPin, clockPin, instances=1)[source]

Bases: pyupm_my9221.MY9221

API for Grove LED Bars base on the MY9221.

ID: groveledbar

Name: LED Bar

Other Names: MY9221 LED Bar

Category: display

Manufacturer: seeed

Link:http://www.seeedstudio.com/wiki/Grove_-_LED_Bar

Connection: gpio

Kit: eak This is a 10-segment LED bar, with 8 green segments, 1 yellow segment, and one red segment. They can be daisy chained together so that this module can control multiple LED bars.

C++ includes: groveledbar.hpp

setBarLevel(level, greenToRed=True, barNumber=0)[source]

void setBarLevel(uint8_t level, bool greenToRed=true, unsigned int barNumber=0)

Sets the bar level

level: Selected level for the bar (0 - 10). 0 is off

greenToRed: true if you start the level on the first green LED, false otherwise

barNumber: If you have multiple LED bars chained together, this argument selects a specific bar starting at 0. The default is 0.

class pyupm_my9221.MY9221(dataPin, clockPin, instances=1)[source]

Bases: object

clearAll()[source]

void clearAll()

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

refresh()[source]

void refresh()

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

setAll()[source]

void setAll()

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

setAutoRefresh(enable)[source]

void setAutoRefresh(bool 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.

enable: true to enable auto refresh, false otherwise

setHighIntensityValue(intensity)[source]

void setHighIntensityValue(int 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.

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

setLED(led, on)[source]

void setLED(int led, bool on)

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

led: The LED whose state you wish to change

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

setLowIntensityValue(intensity)[source]

void setLowIntensityValue(int 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.

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