Skip to content

Instantly share code, notes, and snippets.

@esaborit4code
Last active December 19, 2015 17:38
Show Gist options
  • Save esaborit4code/5992740 to your computer and use it in GitHub Desktop.
Save esaborit4code/5992740 to your computer and use it in GitHub Desktop.
Setup files to control a window's blind with IR remote and GPIO pins.
begin
prog = irexec
button = KEY_REWIND
config = echo 0 > /sys/class/gpio/gpio21/value; echo 1 > /sys/class/gpio/gpio22/value; echo "`date` ROLL UP!" >> /home/pi/window_blind_log;
end
begin
prog = irexec
button = KEY_FASTFORWARD
config = echo 1 > /sys/class/gpio/gpio21/value; echo 0 > /sys/class/gpio/gpio22/value; echo "`date` ROLL DOWN!" >> /home/pi/window_blind_log;
end
begin
prog = irexec
button = KEY_PAUSE
config = echo 0 > /sys/class/gpio/gpio21/value; echo 0 > /sys/class/gpio/gpio22/value; echo "`date` STOP!" >> /home/pi/window_blind_log;
end
########################################################
# /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=""
########################################################
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.
snd-bcm2835
# lirc config
lirc_dev
lirc_rpi gpio_in_pin=18 gpio_out_pin=17
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Start GPIO config for roll up and down the window's blind
sudo -u pi gpio-admin export 21; sudo -u pi echo out > /sys/class/gpio/gpio21/direction;
sudo -u pi gpio-admin export 22; sudo -u pi echo out > /sys/class/gpio/gpio22/direction;
sudo -u pi echo 1 > /sys/class/gpio/gpio21/value;
sudo -u pi echo 0 > /sys/class/gpio/gpio21/value;
sudo -u pi echo 1 > /sys/class/gpio/gpio22/value;
sudo -u pi echo 0 > /sys/class/gpio/gpio22/value;
# Start irexec to listen infrared signals
(sleep 5;
sudo -u pi irexec -d
)&
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment