使用Python模拟操纵杆
我正在尝试使用我的 Arduino 作为操纵杆,但我不知道如何设置它作为一个操纵杆。我有一个想法,用Python从Arduino读取数据并模拟操纵杆。如何使用Python实现虚拟摇杆?还有别的办法吗?
I'm trying to use my Arduino as a joystick, but I don't know how to set it as a joystick. I have an idea which is reading data from Arduino with Python and simulating the joystick. How can I implement a virtual joystick using Python? Is there another way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Arduino 哪种口味?
首先,您需要一个 Uno 模型,请参阅:http://arduino。 cc/blog/2010/09/24/晚餐准备好了/
旧型号只能显示为串行端口(通过 FTDI 芯片组)。
接下来,有一篇文章展示了如何在 Uno 上模拟操纵杆(您需要在 Arduino 论坛上注册才能查看示例)。请参阅: http://arduino.cc/blog/2010/ 10/24/arduino-uno-as-joystick/
注意:您必须更换 Arduino 固件。
Which flavor Arduino?
First, you need an Uno model, see: http://arduino.cc/blog/2010/09/24/dinner-is-ready/
Older models could only show up as serial ports (through the FTDI chipset).
Next, there's an article which shows how to emulate a joystick on the Uno (you will need to register on the Arduino forums to see the examples). See: http://arduino.cc/blog/2010/10/24/arduino-uno-as-joystick/
Note: you will have to replace the Arduino firmware.
这是一个非常古老的答案,但我找到了一个模拟键盘的库,与操纵杆不同,但如果你只使用数字按钮就很好,我只使用通过arduino和python的串行通信。
我通过串口向电脑发送一个单词,然后 python 将其转换为键盘按键。
我希望有一个库可以模拟带有轴的操纵杆。
这是图书馆:
https://github.com/SavinaRoja/PyUserInput
It is a very old answer but i found a library that emulate a keyboard,is not same as joystick but if you use only digital button is good,I use only serial comunication through arduino and python.
I send a word through the serial to pc and python convert it in a keyboard key.
I wish there is a library that could emulate a joystick with axis.
Here is the library:
https://github.com/SavinaRoja/PyUserInput