# horrible abuse of bash to poll the Quantron imx keypad for key presses a=0 b=0 c=0 while true ; do (( i=$(printf "2#"; printf "%d" $(cat /sys/class/gpio/gpio{61..68}/value) ) )) case $i in 240) # no key pressed ;; 176) # "C/100%" key (( a++, b=0, c=0 )) ;; 224) # "enter" key (( a=0, b++, c=0 )) ;; 208) # "ESC" key (( a=0, b=0, c++ )) ;; *) (( a=0, b=0, c=0 )) ;; esac if (( (a+b+c) > 4 )) ; then printf "a=%d, b=%d, c=%d\n" $a $b $c exit 0 fi msleep 10 done