Merge branch 'master' of git.ucc.asn.au:/matches/honours
[matches/honours.git] / research / TCS / pressure / get_pressure.sh
1 #!/bin/bash
2
3 imgdir="/home/sam/Documents/University/honours/pressure_imgs"
4
5 get_digits=/home/sam/Documents/University/honours/research/TCS/pressure/get_digits.py
6 process_digits=/home/sam/Documents/University/honours/research/TCS/pressure/process_digits.py
7
8 mkdir -p $imgdir 2>/dev/null
9 name=$(date +%F-%H%M%S.jpg)
10 fswebcam --device /dev/video1 -r 640x480 --jpeg 85 $imgdir/$name 2>/dev/null
11 $get_digits $imgdir/$name $imgdir/$name 2>/dev/null
12
13 if [ "$1" != "" ]; then
14         eog $imgdir/$name
15 fi
16
17 out=$($process_digits $imgdir/$name)
18
19 count=0
20 while [ "$out" == "?" ]; do
21         sleep 1
22         out=$($process_digits $imgdir/$name)
23         count=$(( $count + 1 ))
24         if [ "$count" == "5" ]; then
25                 echo "#?"
26                 exit 0
27         fi
28 done
29 #rm -f $imgdir/$name
30 echo $out

UCC git Repository :: git.ucc.asn.au