Skip to content

Commit 3870224

Browse files
committed
update gamepad sketch
1 parent d7eadba commit 3870224

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

examples/HID/hid_gamepad/hid_gamepad.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,11 @@ void loop()
241241
delay(2000);
242242

243243

244-
// Test buttons
245-
for (int i=0; i<=15; ++i)
244+
// Test buttons (up to 32 buttons)
245+
for (int i=0; i<32; ++i)
246246
{
247-
Serial.print("Pressing button "); Serial.println(i+1);
248-
gp.buttons = (0x00 | TU_BIT(i));
247+
Serial.print("Pressing button "); Serial.println(i);
248+
gp.buttons = (1 << i);
249249
usb_hid.sendReport(0, &gp, sizeof(gp));
250250
delay(1000);
251251
}

0 commit comments

Comments
 (0)