Skip to content

Commit 670355e

Browse files
committed
removing use of gamepad
1 parent 5b5980c commit 670355e

File tree

3 files changed

+8
-35
lines changed

3 files changed

+8
-35
lines changed

adafruit_clue.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
import audiobusio
5454
import audiopwmio
5555
import audiocore
56-
import gamepad
5756
import touchio
5857

5958
__version__ = "0.0.0-auto.0"
@@ -197,7 +196,6 @@ def __init__(self):
197196
self._a.switch_to_input(pull=digitalio.Pull.UP)
198197
self._b = digitalio.DigitalInOut(board.BUTTON_B)
199198
self._b.switch_to_input(pull=digitalio.Pull.UP)
200-
self._gamepad = gamepad.GamePad(self._a, self._b)
201199

202200
# Define LEDs:
203201
self._white_leds = digitalio.DigitalInOut(board.WHITE_LEDS)
@@ -350,29 +348,6 @@ def button_b(self):
350348
"""
351349
return not self._b.value
352350

353-
@property
354-
def were_pressed(self):
355-
"""Returns a set of the buttons that have been pressed.
356-
357-
.. image :: ../docs/_static/button_b.jpg
358-
:alt: Button B
359-
360-
To use with the CLUE:
361-
362-
.. code-block:: python
363-
364-
from adafruit_clue import clue
365-
366-
while True:
367-
print(clue.were_pressed)
368-
"""
369-
ret = set()
370-
pressed = self._gamepad.get_pressed()
371-
for button, mask in (("A", 0x01), ("B", 0x02)):
372-
if mask & pressed:
373-
ret.add(button)
374-
return ret
375-
376351
def shake(self, shake_threshold=30, avg_count=10, total_delay=0.1):
377352
"""
378353
Detect when the accelerometer is shaken. Optional parameters:

examples/advanced_examples/clue_ams_remote_advanced.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,20 +136,18 @@
136136
time.sleep(0.25)
137137

138138
# If button B (on the right) is pressed, it increases the volume
139-
if "B" in clue.were_pressed:
139+
if clue.button_b:
140140
ams.volume_up()
141-
a = clue.were_pressed
142141
time.sleep(0.35)
143-
while "B" in clue.were_pressed:
142+
while clue.button_b:
144143
ams.volume_up()
145144
time.sleep(0.07)
146145

147146
# If button A (on the left) is pressed, the volume decreases
148-
if "A" in clue.were_pressed:
147+
if clue.button_a:
149148
ams.volume_down()
150-
a = clue.were_pressed
151149
time.sleep(0.35)
152-
while "A" in clue.were_pressed:
150+
while clue.button_a:
153151
ams.volume_down()
154152
time.sleep(0.07)
155153
time.sleep(0.01)

examples/clue_ams_remote.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,18 @@
6262
time.sleep(0.25)
6363

6464
# If button B (on the right) is pressed, it increases the volume
65-
if "B" in clue.were_pressed:
65+
if clue.button_b:
6666
ams.volume_up()
6767
time.sleep(0.30)
68-
while "B" in clue.were_pressed:
68+
while clue.button_b:
6969
ams.volume_up()
7070
time.sleep(0.07)
7171

7272
# If button A (on the left) is pressed, the volume decreases
73-
if "A" in clue.were_pressed:
73+
if clue.button_a:
7474
ams.volume_down()
7575
time.sleep(0.30)
76-
while "A" in clue.were_pressed:
76+
while clue.button_a:
7777
ams.volume_down()
7878
time.sleep(0.07)
7979

0 commit comments

Comments
 (0)