Qwiic Joystick Hookup Guide
Arduino Examples
Please use the following links and the internet for a better understanding of I2C and how it works in the Arduino IDE:
- A tutorial on I2C.
- An in-depth overview of the Wire (I2C) library.
Example 1: Basic Readings
This sketch looks at the registers for the current joystick position and button state; the values are sent to the Serial Monitor. Make sure you are using a baudrate of 9600bps.
Example 2: I2C Address Change and Firmware Version Read
This sketch takes an entry from the Serial Monitor, in a decimal value, and changes the I2C address of the device. The firmware version is then read to confirm that the address was changed. Make sure you are using a baudrate of 9600bps.
Example 3: I2C Scanner
This sketch is from the I2C scanner example from the Arduino Playground webpage. The sketch scans for devices on the I2C bus and reports them on the Serial Monitor. Make sure you are using a baudrate of 9600bps.
Example 4: Joystick Serial Output
This sketch takes values of the joystick and converts it to directional printouts on the Serial Monitor. It also reads out if the button was pressed. Make sure you are using a baudrate of 9600bps.