#!/bin/bash
while :
do
	for(( i=0; i<5; i++))
	do
	let "a = $i % 2"
	let "b = $i / 2 % 2"
	let "c = $i / 4 % 2"
	gpio -g write 14 $a
	gpio -g write 15 $b
	gpio -g write 18 $c
		for(( j=0; j<8; j++))
		do
			let "d = $j % 2"
			let "e = $j / 2 % 2"
			let "f = $j / 4 % 2"
			gpio -g write 23 $d
			gpio -g write 24 $e
			gpio -g write 25 $f
			sleep .01
			x=`gpio -g read 8`
			if [ "$x" -eq "0" ]; then
				echo "Row[$i], Col[$j]"
			fi
		done
	done
done
