树莓派1代 B版(512M内存) 安装红外线遥控 [手记未完]

By | 2018-11-26

1)先安装 lirc

apt-get install lirc

2)编辑 /etc/modules ,添加下面的内容

lirc_dev

lirc_rpi gpio_in_pin=23 gpio_out_pin=22

3)在  /root 目录下新建一个 config.txt 文件,内容如下:

Add to config.txt
dtoverlay=lirc-rpi

4)编辑 /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=”default”
# usually /dev/lirc0 is the correct setting for systems using udev
DEVICE=”/dev/lirc0″
MODULES=”lirc_rpi”

# Default configuration files for your hardware if any
LIRCD_CONF=””
LIRCMD_CONF=””
########################################################

5)重启PI

6)测试遥控器

mode2 -d /dev/lirc0

这时候按遥控器上的按键应该会有些字符显示的,表示驱动成功。

7)学习按键

/etc/init.d/lirc stop 停止lirc

irrecord -d /dev/lirc0 ~/lircd.conf 记录按键

mv ~/lircd.conf /etc/lirc/lircd.conf 更换按键配置

/etc/init.d/lirc start 启动lirc

發佈回覆