import pygame
pygame.init()
j = pygame.joystick.Joystick(0)
j.init()
当我在我的 Raspberry-Pi 上运行这段代码时,我收到了以下错误:
j = pygame.joystick.Joystick(0)
pygame.error: Invalid joystick device number
这段代码在几个月前就可以运行了,但显然有些地方发生了变化,我无法弄清楚是什么,因为文档与以前完全一样。非常感谢有关此问题的任何帮助或知识。
请您参考如下方法:
我没有连接到 Pi 的 Controller 。
就我而言,我没有运行 ds4drv。
在另一个终端窗口中运行:
sudo ds4drv
并连接您的 DS4 Controller 。
