sparkfun_qwiictwist

CircuitPython library for the Sparkfun Qwiic Twist Rotary Encoder

  • Author(s): Gaston Williams

Implementation Notes

Hardware:

  • This is library is for the SparkFun Qwiic Twist Rotary Encoder.

  • SparkFun sells these at its website: www.sparkfun.com

  • Do you like this library? Help support SparkFun. Buy a board! https://www.sparkfun.com/products/15083

Software and Dependencies:

class sparkfun_qwiictwist.Sparkfun_QwiicTwist(i2c: busio.I2C, address: int = 63, debug: bool = False)

CircuitPython class for the Sparkfun QwiicTwist RGB Rotary Encoder

Initialize Qwiic Twist for i2c communication.

property blue: int

Get the value of the blue LED

property blue_connection: int

Get the value of the blue LED connection.

change_address(new_address: int) bool

Change the i2c address of Twist Rotary Encoder snd return True if successful.

clear_interrupts() None

Clears the moved, clicked, and pressed bits

property clicked: bool

Return true if a click event has occurred. Event flag is then reset.

connect_color(red_value: int, green_value: int, blue_value: int) None

Connect all the rgb color for the encoder LEDs

property connected: bool

Check the id of Rotary Encoder. Returns True if successful.

property count: int

Returns the number of indents since the user turned the knob.

property difference: int

Return the difference in number of clicks since previous check. The value is cleared after it is read.

property green: int

Get the value of the green LED.

property green_connection: int

Get the value of the green LED connection.

property int_timeout: int

Get number of milliseconds that elapse between the end of the knob turning and interrupt firing.

property moved: bool

Return true if the knob has been twisted.

property pressed: bool

“Return true if button is currently pressed.

property red: int

Get the value of the red LED.

property red_connection: int

Get the value of the red LED connection

set_color(red_value: int, green_value: int, blue_value: int) None

Set the rgb color of the encoder LEDs

property time_since_last_movement: int

Return the number of milliseconds since the last encoder movement

property time_since_last_press: int

Return the number of milliseconds since the last button press and release

property version: str

Return the version string for the Twist firmware.