useful_linux_scripts/raspberry_pi_IR_take_pic.sh
robin 1c23b53add gpio17 is an LED on th7
Sp gpo27 chosen to active IR leds instead.
2023-12-10 11:40:44 +00:00

26 lines
667 B
Bash
Executable File

# take a picture.
# First turn on IR LEDS
# GPIO27 is the ground side of the IR leds, so setting it to 0 turns them on
# Note this is through a 220 Ohm resdistor limiting the current to about 10 mA
if [ -d /sys/class/gpio/gpio27 ]; then
echo " gpio27 already exists "
else
echo 27 > /sys/class/gpio/export
fi
sleep 0.1
# turn on the IR leds
echo out > /sys/class/gpio/gpio27/direction
echo 0 > /sys/class/gpio/gpio27/value
export d=`date`
export picname=`echo $d | sed 's/ /_/g' | sed 's/:/_/g' `
#echo $picname
libcamera-jpeg -o /home/robin/Pictures/$picname.jpg -t 2000 --width 1200 --height 1000
# turn off IR LEDS
echo 1 > /sys/class/gpio/gpio27/value