m5stack_unit8.angle

Library for M5Stack’s Unit8 Encoder and Unit8 Angle breakouts.

  • Author(s): Neradoc

Implementation Notes

Dev notes: the board expects a stop between write and read rather than a real restart, so we cannot use “write_then_readinto”, but a write followed by a read.

Hardware:

Software and Dependencies:

class m5stack_unit8.angle.Unit8Angle(i2c, precision=PRECISION_12BITS, address=_DEFAULT_ADDRESS, brightness=1.0, auto_write=True)

Driver for the Unit8 8-potentiometers board.

property angles

Return a list with the values of the 8 encoders. Values are adjusted to be 16 bits: 0-65535.

property angles_12bit

Return a list with the raw 12 bits values (0-4095) of the 8 encoders

property angles_8bit

Return a list with the raw 8 bits values (0-255) of the 8 encoders

get_angle(num)

Return the value of one encoder. Values are adjusted to be 16 bits: 0-65535.

get_angle_12bit(num)

Return the raw 12 bits value (0-4095) of one encoder

get_angle_8bit(num)

Return the raw 8 bits value (0-255) of one encoder

get_led(position)

Get the current color of an RGB LED

property precision

Bits precision of the potentiometer range. 8 or 12.

set_led(position, color, brightness=100)

Set the color to one RGB LED

property switch

The state of the switch

m5stack_unit8.encoder

Library for M5Stack’s Unit8 Encoder and Unit8 Angle breakouts.

  • Author(s): Neradoc

Implementation Notes

Dev notes: the board expects a stop between write and read rather than a real restart, so we cannot use “write_then_readinto”, but a write followed by a read.

Hardware:

Software and Dependencies:

class m5stack_unit8.encoder.Unit8Encoder(i2c, address=_DEFAULT_ADDRESS, brightness=1.0, auto_write=True)

Driver for the Unit8 8-encoders board.

property buttons

A tuple with all the button values

get_increment(num)

Return the value of one encoder increment. This value is reset to 0 after read.

get_led(position)

Get the current color of an RGB LED

get_position(num)

Return the position of one encoder.

property increments

Return a list with the values of the 8 encoders. These value is reset to 0 after read.

property positions

A list with the values of the 8 encoders.

reset()

Reset the encoder position values

set_led(position, color)

Set the color to one RGB LED

set_position(num, position)

Set the position of one encoder.

property switch

The value of the switch