3 # More info: http://cyber-place.ru/showpost.php?p=7797&postcount=82
5 RAWTEMP=$(i2cget -y 0 0x40 0xe3 w)
6 RAWHUMI=$(i2cget -y 0 0x40 0xe5 w)
8 if (echo "$RAWTEMP"| grep -Eq '0x[0-9a-f]{4}'); then
9 HEXORDERED=$(echo "$RAWTEMP"|sed -r 's/0x([0-9a-f]{2})([0-9a-f]{2})/0x\2\1/')
10 DECRAW=$(($HEXORDERED))
11 echo $DECRAW | awk -v tem=${DECRAW} '{ printf "%.2f stC\n", -46.85+((tem*175.72)/65536)}'
13 if (echo "$RAWHUMI"| grep -Eq '0x[0-9a-f]{4}'); then
14 HEXORDERED=$(echo "$RAWHUMI"|sed -r 's/0x([0-9a-f]{2})([0-9a-f]{2})/0x\2\1/')
15 DECRAW=$(($HEXORDERED))
16 echo $DECRAW | awk -v hum=${DECRAW} '{ printf "%.2f %%RH\n", -6+((hum*125)/65536)}'