sparkfun_qwiicjoystick¶
CircuitPython library for Sparkfun Qwiic Joystick
Author(s): Gaston Williams
Implementation Notes¶
Hardware:
This is library is for the SparkFun Qwiic Joystick.
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/15168
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
- class sparkfun_qwiicjoystick.Sparkfun_QwiicJoystick(i2c, address=32, debug=False)¶
CircuitPython class for the Sparkfun QwiicJoystick Usage:
# import the CircuitPython board and busio libraries
import board import busio
# Create bus object using the board’s I2C port i2c = busio.I2C(board.SCL, board.SDA)
joystick = QwiicJoystick(i2c) # default address is 0x20
# use QwiicJoystick(i2c, address) for a different address # joystick = QwiicJoystick(i2c, 0x21)
Initialize Qwiic Joystick for i2c communication.
- property button¶
0 if button is down, 1 if button is up.
- property button_status¶
1 if button pressed between reads, cleared after read.
- property connected¶
True if the Joystick is connected and a valid id is successful read.
- property horizontal¶
X value from 0 - 1023 of the joystick postion.
- set_i2c_address(new_address)¶
Change the i2c address of Joystick snd return True if successful.
- property version¶
Firmware version string for joystick.
- property vertical¶
Y value from 0 to 1023 of the joystick postion.