Skip to content

Commit e548db1

Browse files
committed
remove button_Z button_C properties and fix nunchuk_simpletest.py
1 parent f88f653 commit e548db1

File tree

2 files changed

+6
-23
lines changed

2 files changed

+6
-23
lines changed

adafruit_nunchuk.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,22 +91,6 @@ def acceleration(self):
9191
"""The current accelerometer reading."""
9292
return self._acceleration()
9393

94-
@property
95-
def button_C(self): # pylint: disable=invalid-name
96-
"""
97-
The current pressed state of button C.
98-
"""
99-
print("`button_C` is deprecated. Please use the `buttons` property instead")
100-
return self._buttons().C
101-
102-
@property
103-
def button_Z(self): # pylint: disable=invalid-name
104-
"""
105-
The current pressed state of button Z.
106-
"""
107-
print("`button_Z` is deprecated. Please use the `buttons` property instead")
108-
return self._buttons().Z
109-
11094
def _joystick(self, do_read=True):
11195
if do_read:
11296
self._read_data()

examples/nunchuk_simpletest.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88
nc = adafruit_nunchuk.Nunchuk(board.I2C())
99

1010
while True:
11-
joystick, buttons, acceleration = nc.values
12-
print("joystick = {},{}".format(joystick.x, joystick.y))
13-
print(
14-
"accceleration ax={}, ay={}, az={}".format(
15-
acceleration.x, acceleration.y, acceleration.z
16-
)
17-
)
11+
x, y = nc.joystick
12+
ax, ay, az = nc.acceleration
13+
print("joystick = {},{}".format(x, y))
14+
print("accceleration ax={}, ay={}, az={}".format(ax, ay, az))
15+
16+
buttons = nc.buttons
1817
if buttons.C:
1918
print("button C")
2019
if buttons.Z:

0 commit comments

Comments
 (0)