Sunday, July 07, 2019

树莓派2/B+便携式套装升级版教程:使用按键来模拟键盘/鼠标/摇杆使用 | ukonline2000's blog

树莓派2/B+便携式套装升级版教程:使用按键来模拟键盘/鼠标/摇杆使用 | ukonline2000's blog

EmailThis Premium lets you save unlimited bookmarks, PDF, DOCX files, PPTs and images. It also gives you a PDF copy of every page that you save. Upgrade to Premium →

TB2dnKugFXXXXaFXXXXXXXXXXXX_!!13118880TB2FqV.gFXXXXbyXpXXXXXXXXXX_!!13118880

很多玩 家拿到便携式套装以后不知道如何使用按键,或者不知道按键用来干什么,今天小编就教大家将套装的按键模拟成键盘或摇杆使用。

购买链接:https://item.taobao.com/item.htm?&id=520562357826

1.组装好套装,启动系统并按照之前的教程配置屏幕

2.ssh方式登录树莓派,安装相关的python库和软件

$sudo apt-get update
$sudo apt-get install libudev-dev
$sudo apt-get install python-pip
$sudo pip install rpi.gpio
$sudo pip install python-uinput

3.注册uinput模块(也可以将这行添加到/etc/modules,开机后自动注册模块)

$sudo modprobe uinput

4.解压附件程序,并拷贝到树莓派中(python-keys

5.运行模拟键盘或摇杆程序,并按下按键看看效果

$sudo python rpi-2.2TFT-kbrd.py

$sudo python rpi-2.2TFT-jstk.py

$sudo python rpi-2.2TFT-mouse.py

注明:uinput的键值一般是uinput.KEY_XX(XX就是按键,比如字母A,就是uinput.KEY_A)

python-uinput库的使用可以参考 (https://github.com/tuomasjjrasanen/python-uinput)
RPi.GPIO库的使用参考(http://pypi.python.org/pypi/RPi.GPIO/)

Source: http://ukonline2000.com/?p=798#comment-2048

Please check the attached file.

EmailThis was not able to extract useful content from the website. Hence, we have saved the webpage to a PDF file. You can find that attached along with this email.

Upgrade to Premium Plan

✔ Save unlimited bookmarks.

✔ Save PDFs, DOCX files, images and Excel sheets as email attachments.

✔ Get priority support and access to latest features.

Upgrade to Premium

No comments: