#!/bin/bash
shopt -s expand_aliases
source ./.bash_aliases
mux1 1
mux2 0
for(( i = 0; i < 8; i++)) 
do
	echo "Activating Latch $((i+1))"
	let "a = $i % 2"
	let "b = $i / 2 % 2"
	let "c = $i / 4 % 2"
	ma0 $a
	ma1 $b
	ma2 $c
	for(( j = 0; j < 8; j++))
	do
		echo "Activating Pin $j"
		let "d = $j % 2"
		let "e = $j / 2 % 2"
		let "f = $j / 4 % 2"

		fa0 $d
		fa1 $e
		fa2 $f
		sleep $1
	done
done

mux1 0
mux2 1
for(( i = 0; i < 5; i++)) 
do
	echo "Activating Latch $((i + 9))"
	let "a = $i % 2"
	let "b = $i / 2 % 2"
	let "c = $i / 4 % 2"
	ma0 $a
	ma1 $b
	ma2 $c
	for(( j = 0; j < 8; j++))
	do
		echo "Activating Pin $j"
		let "d = $j % 2"
		let "e = $j / 2 % 2"
		let "f = $j / 4 % 2"

		fa0 $d
		fa1 $e
		fa2 $f
		sleep $1
	done
done

