Simple test¶
Ensure your device works with this simple test.
1# SPDX-FileCopyrightText: Copyright (c) 2023 Liz Clark for Adafruit Industries
2#
3# SPDX-License-Identifier: MIT
4
5import time
6import board
7import adafruit_wii_classic
8
9i2c = board.STEMMA_I2C()
10ctrl_pad = adafruit_wii_classic.Wii_Classic(i2c)
11
12while True:
13 left_x, left_y = ctrl_pad.joystick_l
14 right_x, right_y = ctrl_pad.joystick_r
15 left_pressure = ctrl_pad.l_shoulder.LEFT_FORCE
16 right_pressure = ctrl_pad.r_shoulder.RIGHT_FORCE
17 print("joystick_l = {},{}".format(left_x, left_y))
18 print("joystick_r = {},{}".format(right_x, left_y))
19 print("left shoulder = {}".format(left_pressure))
20 print("right shoulder = {}".format(right_pressure))
21 if ctrl_pad.buttons.A:
22 print("button A")
23 if ctrl_pad.buttons.B:
24 print("button B")
25 if ctrl_pad.d_pad.UP:
26 print("dpad Up")
27 if ctrl_pad.d_pad.DOWN:
28 print("dpad Down")
29 if ctrl_pad.d_pad.LEFT:
30 print("dpad Left")
31 if ctrl_pad.d_pad.RIGHT:
32 print("dpad Right")
33 time.sleep(0.5)