Path: blob/master/Tools/Frame_params/Parrot_Disco/gpio.sh
9660 views
#!/bin/sh1# this is a script triggered from GPIO changes. It is setup to take photos2# start/stop recording and start/stop streaming on a disco34PIN="$1"5VALUE="$2"6echo "got pin=$PIN value=$VALUE"78PATH=$PATH:/bin:/usr/bin:/data/ftp/internal_000/ardupilot9export PATH1011cd /data/ftp/internal_000/ardupilot1213if [ $PIN = 100 ]; then14# take photo when high15if [ $VALUE = 1 ]; then16echo "$(date) Taking picture" >> gpio.log17/usr/bin/pimpctl take-picture front18fi19fi2021if [ $PIN = 101 ]; then22# recording start/stop23if [ $VALUE = 1 ]; then24echo "$(date) Starting recording" >> gpio.log25/usr/bin/pimpctl recording-start front26else27echo "$(date) Stopping recording" >> gpio.log28/usr/bin/pimpctl recording-stop front29fi30fi3132if [ $PIN = 102 ]; then33GCS_IP=$(netstat -n|grep 14550 | head -1 | awk '{print $5}'| cut -d: -f1)34# streaming start/stop35if [ $VALUE = 1 ]; then36echo "$(date) Starting streaming to $GCS_IP 8888" >> gpio.log37/usr/bin/pimpctl stream-start front $GCS_IP 888838else39echo "$(date) Stopping streaming to $GCS_IP 8888" >> gpio.log40/usr/bin/pimpctl stream-stop front $GCS_IP 888841fi42fi434445