Skip to content

Commit 24a78d6

Browse files
committed
updated PlayStation spinner code for QT Py
1 parent 9caf603 commit 24a78d6

File tree

1 file changed

+15
-15
lines changed
  • PlayStation_Controller_Spinner

1 file changed

+15
-15
lines changed

PlayStation_Controller_Spinner/code.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,38 @@
11
# SPDX-FileCopyrightText: 2023 John Park w/ Tod Kurt ps2controller library
22
#
33
# SPDX-License-Identifier: MIT
4-
# The Takara Game of Life PlayStation roulette wheel controller spinner
4+
# The Takara Game of Life PlayStation roulette wheel controller spinner (TAKC-00001)
55
# sends two sets of held CIRCLE buttons with randomized hold time periods
66
# this code turns that into mouse click spamming (the CIRCLE button also spams)
7+
# Tested on QT Py RP2040
78

89
import time
910
import board
1011
import usb_hid
11-
import digitalio
12+
import neopixel
1213
from adafruit_hid.keycode import Keycode
1314
from adafruit_hid.keyboard import Keyboard
1415
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
1516
from adafruit_hid.mouse import Mouse
1617
from ps2controller import PS2Controller
1718

18-
# turn on Pico LED
19-
led = digitalio.DigitalInOut(board.GP25)
20-
led.direction = digitalio.Direction.OUTPUT
21-
led.value = True
19+
# turn on neopixel
20+
led = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.1)
21+
led.fill(0x331000) # amber while we wait for controller to connect
2222

2323
mouse = Mouse(usb_hid.devices)
2424

2525
keyboard = Keyboard(usb_hid.devices)
2626
layout = KeyboardLayoutUS(keyboard)
2727

28-
# create controller object with Pico wiring, disable unused PS2 features
28+
# create controller object with QT Py wiring
2929
psx = PS2Controller(
30-
dat=board.GP2,
31-
cmd=board.GP3,
32-
att=board.GP4,
33-
clk=board.GP5,
34-
enable_sticks=False,
35-
enable_rumble=False,
36-
enable_pressure=False,
30+
dat=board.A0,
31+
cmd=board.A1,
32+
att=board.A2,
33+
clk=board.A3
3734
)
35+
led.fill(0x0010ee) # a nice PlayStation blue
3836

3937
circle_held = False
4038
spam_speed = 0.001
@@ -46,6 +44,8 @@
4644
("DOWN"): (0, Keycode.S),
4745
("RIGHT"): (0, Keycode.D),
4846
("LEFT"): (0, Keycode.A),
47+
("L3"): (0, Keycode.V),
48+
("R3"): (0, Keycode.B),
4949
("L2"): (0, Keycode.R),
5050
("R2"): (0, Keycode.T),
5151
("L1"): (0, Keycode.F),
@@ -61,7 +61,7 @@
6161
while True:
6262
events = psx.update()
6363
if events:
64-
print("events", events)
64+
print(events)
6565
for event in events:
6666
if buttonmap[event.name][0] == 0: # regular button
6767
if event.pressed:

0 commit comments

Comments
 (0)