BananaPi 拥有很多令人印象深刻的板载接口,相信大家都有所了解。
比如:红外接收、
Sata 及硬盘供电(虽然大部分硬盘只要800ma的电流)、
板载的无线网卡、......
今天我们来调试一下BananaPi M1+ 的红外接收
准备:遥控(arduino常用的那种就可以)、BananaPi m1+、电源(5v2A)、最新的bananian 镜像、tf卡(>=2GB,建议4GB+的高速卡)。
过程:
1.自作系统镜像,
使用SDFormatter 格式化tf卡;
使用Win32DiskImager写入bananian;
~【附】:
SDFormatter :http://www.sdcard.org/chs/index.html
win32diskmager :http://sourceforge.net/projects/win32diskimager/
2.使用ttl 线连接bananapi 或者 ssh,ttl线注意看清线的定义。
这里我将使用ssh 远程,获取pi的ip(可以上路由,或者直接用网线和电脑连接,电脑做网关),然后使用putty等客户端连接
3.简单配置一下 bananian-config ,其中hardware选项要选择M1+ ,如果你是用其它型号,那么要对应;扩展使用sd卡全部空间。
Do you want to change your root password? (y/N) y
---------------------------------------------------------------------------------
Your current timezone is \'Asia/Shanghai\'. Do you want to change it? (y/N) y
---------------------------------------------------------------------------------
Your current locale is \'en_US.UTF-8\'. Do you want to change it? (y/N) y
---------------------------------------------------------------------------------
Your current hostname is \'bananapi\'. Do you want to change it? (y/N) y
---------------------------------------------------------------------------------
Your current hardware configuration is: BananaPi
Do you want to change it? (y/N) y
Do you want to expand the root file system (recommended)? (y/N) y
3.安装红外相关的软件包
apt-get install lirc
apt-get install evtest
lirc 是开源的红外控制软件;
安装完成后,修改 /etc/lirc/hardware.conf文件内容,如下
nano /etc/lirc/hardware.conf
# /etc/lirc/hardware.conf
#
# Arguments which will be used when launching lircd
LIRCD_ARGS="--uinput"
#Don\'t start lircmd even if there seems to be a good config file
#START_LIRCMD=false
#Don\'t start irexec, even if a good config file seems to exist.
#START_IREXEC=false
#Try to load appropriate kernel modules
LOAD_MODULES=true
# Run "lircd --driver=help" for a list of supported drivers.
DRIVER="UNCONFIGURED"
# usually /dev/lirc0 is the correct setting for systems using udev
DEVICE="/dev/input/event0"
MODULES="sunxi-ir"
ctrl+O保存 ctrl+x退出
4.测试lirc是否可以正常启动
service lirc start
这时先别急着按遥控器,因为默认不会有什么反应的,你没有绑定对应按键的操作。默认绑定为空或者一些系统操作(音量加减神马的)
5.测试遥控器
evtest
选 0 ,大家看实际情况。一定是 xunxi-ir
这是挨着个的按遥控按钮吧
大家注意到value 0value 1
每个按键对应两条,按下是1,松开是0
另外每个按钮都有对应的code 之后我们会用到。
本篇不做描述,下篇来讲解录制按键和绑定事件。
为了方便大家,这里我打包了自己安装好的软件。直接解压就能用
附件:
另一个回头补上,论坛附件限制,
|