Skip to content

Commit 0ff128e

Browse files
committed
Fix example for gamepad
The example code for the gamepad module would skip detected button presses in the code that waits for a button to be released, because it would run it even when no button is pressed. Also updated the example pin names to not use RX and TX.
1 parent d9ae709 commit 0ff128e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

shared-bindings/gamepad/GamePad.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ gamepad_obj_t* gamepad_singleton = NULL;
4949
//|
5050
//|
5151
//| pad = gamepad.GamePad(
52-
//| digitalio.DigitalInOut(board.D0),
53-
//| digitalio.DigitalInOut(board.D1),
52+
//| digitalio.DigitalInOut(board.D10),
53+
//| digitalio.DigitalInOut(board.D11),
5454
//| )
5555
//|
5656
//| y = 0
@@ -63,8 +63,9 @@ gamepad_obj_t* gamepad_singleton = NULL;
6363
//| y += 1
6464
//| print(y)
6565
//| time.sleep(0.1)
66-
//| while pad.get_pressed():
66+
//| while buttons:
6767
//| # Wait for all buttons to be released.
68+
//| buttons = pad.get_pressed()
6869
//| time.sleep(0.1)
6970
//|
7071

0 commit comments

Comments
 (0)