Skip to content

Instantly share code, notes, and snippets.

@wgx
Created June 26, 2018 16:55
Show Gist options
  • Save wgx/34d6a9ee3c24998e8fd41f0787bdf4dc to your computer and use it in GitHub Desktop.
Save wgx/34d6a9ee3c24998e8fd41f0787bdf4dc to your computer and use it in GitHub Desktop.
#!/bin/bash
lsb=$(i2cget -y -f 0 0x34 0x5f)
msb=$(i2cget -y -f 0 0x34 0x5e)
bin=$(( $(($msb << 4)) | $(($lsb & 0x0F))))
cel=`echo $bin | awk '{printf("%.0f", ($1/10) - 144.7)}'`
fah=`echo $cel | awk '{printf("%.0f", ($1 * 1.8) + 32)}'`
echo "CHIP Temp: $cel°C $fah°F"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment