Skip to content

Instantly share code, notes, and snippets.

@sixem
Created April 17, 2019 11:45
Show Gist options
  • Save sixem/04c2b5d06c6308b3a8453a5d99fed947 to your computer and use it in GitHub Desktop.
Save sixem/04c2b5d06c6308b3a8453a5d99fed947 to your computer and use it in GitHub Desktop.
temp.sh (TEMPered)
#!/bin/bash
OUTLINE=`/home/pi/TEMPered/build/utils/hid-query /dev/hidraw1 0x01 0x80 0x33 0x01 0x00 0x00 0x00 0x00|grep -A1 ^Response|tail -1`
OUTNUM=`echo $OUTLINE|sed -e 's/^[^0-9a-f]*[0-9a-f][0-9a-f] [0-9a-f][0-9a-f] \([0-9a-f][0-9a-f]\) \([0-9a-f][0-9a-f]\) .*$/0x\1\2/'`
HEX4=${OUTNUM:2:4}
DVAL=$(( 16#$HEX4 ))
CTEMP=$(bc <<< "scale=2; $DVAL/100")
FTEMP=$(echo "scale=2;((9/5) * $CTEMP) + 32" |bc)
echo "$CTEMP"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment