![](images/example-ir-remote.jpg)
lircd.conf & .lircrc two files are
setting for this remote control
1. sudo apt-get install lirc
2. sudo apt-get install python-lirc
You can test the
remote works with the mode2 program
![](images/ir-mudule-setting06.jpg)
after pressing some buttons, you get a
series of pulse/space lengths then your Infrared
Receiver is working.
2. Download 3 Remote control setting file
lircd.conf lircrc hardware.conf
![](images/ir-setting-01.jpg)
Copy .lircrc to /root
![](images/ir-setting-02.jpg)
Copy hardware.conf & lircd.conf to /etc/lirc
or you can use sudo nano /ect/lirc/hardware.conf
![](images/ir-mudule-setting02.jpg)
![](images/ir-mudule-setting.jpg)
sudo nano /etc/modules
add lirc_dev
lirc_rpi gpio_in_pin=23
reboot
The
/etc/lirc/lirc.conf
file
tells LIRC about your remote control. Since every remote
control is different, you need to generate a different
config for each remote control.
![](images/ir-mudule-setting05.jpg)
> cp /etc/lirc/lircd.conf /home/pi
( copy the file if it already exists as a
backup )
> rm /etc/lirc/lircd.conf
( need to remove first copy, irrecord
won't overwrite )
> fuser /dev/lirc0
( check if
/dev/lirc0 is occupied )
> sudo kill 1000
( Kill the process
using dev/lirc0 )
> fuser /dev/lirc0 ( Check to see if it is
still running, if so sudo reboot, This is a bug )
> sudo irrecord -f -d /dev/lirc0 /etc/lirc/lircd.conf
--disable-namespace
( Run Irrecord on /dev/lirc0 with a config
file at /etc/lirc/lircd.conf whilst
disabling namespace )
... Follow instructions
... Use BUT_ at the start of the button
names to make sure it does not overwrite KEY_DOWN
etc
which is a keyboard event.
![](images/ir-mudule-setting03.jpg)
The ~/.lircrc file
is used to configure what other programs see from LIRC.
edit the .lircrc file
![](images/ir-mudule-setting04.jpg)
type irw you will see the system catch your
key
![](images/ir-irw-demo01.jpg)
irw read key when you press the remote control
irexec is
a program that runs commands mapped to IR signals. It is
configured using the ~/.lircrc file.
![](images/ir-irexec-demo01.jpg)
irexec read key when you press the remote
control
![](images/ir-python-demo01.jpg)
python IRR_v2.py read key
Support our scratch
driver software, can be easy use in scratch
Scratch driver software
![](images/ir-scratch-remote-demo01.jpg)
Command " LIRREMOTE" +"INIT" to
active IR REMOTE CONTROL
1.broadcast "LIRREMOTEINIT"
2. after broadcast Press the key in remote control
you want use in Scratch
in Sensing --> Slider , you will
see the key you press in the list
![](images/ir-scratch-remote-demo02.jpg)
|