From f8a4c02ef46d9bf417a626f55f31b31d9b28a600 Mon Sep 17 00:00:00 2001 From: dherrada Date: Fri, 18 Nov 2022 13:05:27 -0500 Subject: [PATCH 1/2] Added commented out board.STEMMA_I2C with explanation --- examples/nunchuk_accel_mouse.py | 4 +++- examples/nunchuk_analog_mouse.py | 4 +++- examples/nunchuk_simpletest.py | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/nunchuk_accel_mouse.py b/examples/nunchuk_accel_mouse.py index c386590..bd85898 100644 --- a/examples/nunchuk_accel_mouse.py +++ b/examples/nunchuk_accel_mouse.py @@ -7,7 +7,9 @@ import adafruit_nunchuk m = Mouse(usb_hid.devices) -nc = adafruit_nunchuk.Nunchuk(board.I2C()) +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller +nc = adafruit_nunchuk.Nunchuk(i2c) centerX = 120 centerY = 110 diff --git a/examples/nunchuk_analog_mouse.py b/examples/nunchuk_analog_mouse.py index f26295c..0276f42 100644 --- a/examples/nunchuk_analog_mouse.py +++ b/examples/nunchuk_analog_mouse.py @@ -7,7 +7,9 @@ import adafruit_nunchuk m = Mouse(usb_hid.devices) -nc = adafruit_nunchuk.Nunchuk(board.I2C()) +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller +nc = adafruit_nunchuk.Nunchuk(i2c) centerX = 128 centerY = 128 diff --git a/examples/nunchuk_simpletest.py b/examples/nunchuk_simpletest.py index 7731e90..4454120 100644 --- a/examples/nunchuk_simpletest.py +++ b/examples/nunchuk_simpletest.py @@ -5,6 +5,8 @@ import board import adafruit_nunchuk +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller nc = adafruit_nunchuk.Nunchuk(board.I2C()) while True: From 23cbb07b3d46e456e82e5d62a5e86ff0f24310ef Mon Sep 17 00:00:00 2001 From: foamyguy Date: Mon, 17 Jul 2023 12:27:56 -0500 Subject: [PATCH 2/2] use i2c variable instead of board.I2C() --- examples/nunchuk_simpletest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/nunchuk_simpletest.py b/examples/nunchuk_simpletest.py index 4454120..ec93d52 100644 --- a/examples/nunchuk_simpletest.py +++ b/examples/nunchuk_simpletest.py @@ -7,7 +7,7 @@ i2c = board.I2C() # uses board.SCL and board.SDA # i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller -nc = adafruit_nunchuk.Nunchuk(board.I2C()) +nc = adafruit_nunchuk.Nunchuk(i2c) while True: x, y = nc.joystick