The following page will walk you through the syntax for interfacing with the driver in CircuitPython to read your controller button presses. Note that depending on your controller, all of the functionality may not be available. For example, NES-style controllers will usually only have a D-Pad and buttons for A, B, Start and Select.
import board import adafruit_wii_classic i2c = board.STEMMA_I2C() ctrl_pad = adafruit_wii_classic.Wii_Classic(i2c)
D-Pad
-
Up button -
ctrl_pad.d_pad.UP
-
Down button -
ctrl_pad.d_pad.DOWN
-
Left button -
ctrl_pad.d_pad.LEFT
-
Right button -
ctrl_pad.d_pad.RIGHT
Buttons
-
A button -
ctrl_pad.buttons.A
-
B button -
ctrl_pad.buttons.B
-
X button -
ctrl_pad.buttons.X
-
Y button -
ctrl_pad.buttons.Y
-
Start button -
ctrl_pad.buttons.START
-
Select button -
ctrl_pad.buttons.SELECT
-
Home button -
ctrl_pad.buttons.HOME
-
Left shoulder button -
ctrl_pad.buttons.L
-
Right shoulder button -
ctrl_pad.buttons.R
-
Z left button -
ctrl_pad.buttons.ZL
-
Z right button -
ctrl_pad.buttons.ZR
Analog Joy Sticks
The Wii Classic-style controllers have two analog joysticks. Each joystick outputs an x
and y
axis value.
-
Left joystick -
ctrl_pad.joystick_l
-
Right joystick -
ctrl_pad.joystick_r
You can assign two variables to each joystick object to read the x
and y
coordinates:
left_x, left_y = ctrl_pad.joystick_l
Analog Shoulder Button Force
The official Wii Classic controllers have analog sensors in the left and right shoulder buttons, which let you read the force being applied to the button before it is fully pressed.
-
Left shoulder pressure -
ctrl_pad.l_shoulder.LEFT_FORCE
-
Right shoulder pressure -
ctrl_pad.r_shoulder.RIGHT_FORCE
Text editor powered by tinymce.