Before using an IR remote with PiFace CAD you must first install and setup Linux infrared Remote Control.
wget https://raw.github.com/piface/pifacecad/master/bin/setup_pifacecad_lirc.sh chmod +x setup_pifacecad_lirc.sh sudo ./setup_pifacecad_lirc.shReboot your Raspberry Pi and skip to the next step, Customising for Your Remote Control
Alternatively, to install Linux infrared Remote Control manually, open a Terminal and enter
sudo apt-get install lirc
The latest version of Raspbian should contain the lirc_rpi kernel module. It allows you to specify which GPIO pin the Infrared Receiver is attached to. On PiFace CAD, the Infrared Receiver is connected to GPIO pin 23. To load the module, type
sudo modprobe lirc_rpi gpio_in_pin=23
We will now test that lirc works.
pidof lirc to see if the lirc processes are running.
If this returns a number, you must kill that process with the command
sudo kill process_number
replacing process_number with the number returned by the previous command
Now run lirc with the following command
mode2 -d /dev/lirc0
After pressing some buttons on your remote while pointing it at the IR receiver on PiFace CAD, a series of pulse/space lengths will be printed on your Terminal. Great your Infrared is working. Press
ctrl c to quit this.
To make sure that the module is loaded each time you boot, we need to add some lines to the file/etc/modules , so open it with
sudo in your favourite text editor, eg
sudo leafpad /etc/modules
Add these lines
To set up your Pi to receive IR data from PiFace CAD, first backup the previous Linux Infrared Remote Control configuration with
cp /etc/lirc/hardware.conf hardware.conf.backup
sudo leafpad /etc/lirc/hardware.conf
Change it to the following
# Arguments which will be used when launching lircd
#Don't start lircmd even if there seems to be a good config file
#Don't start irexec, even if a good config file seems to exist.
#Try to load appropriate kernel modules
# Run "lircd --driver=help" for a list of supported drivers.
# usually /dev/lirc0 is the correct setting for systems using udev
# Default configuration files for your hardware if any
Save the file, reboot your Pi
sudo reboot and log back in.