Skip to content

Instantly share code, notes, and snippets.

@fxadecimal
Last active October 24, 2015 11:36
Show Gist options
  • Select an option

  • Save fxadecimal/ca56fc21a672707881bb to your computer and use it in GitHub Desktop.

Select an option

Save fxadecimal/ca56fc21a672707881bb to your computer and use it in GitHub Desktop.
ds18b20 simple temperature reader
#!/usr/bin/env bash
# Turn on one-wire support for rPi
# https://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing/ds18b20
cat /sys/bus/w1/devices/28*/w1_slave |\
grep t= | awk -F't=' '{print $2}' | \
python3 -c 'import sys; sys.stdout.write( str( float(sys.stdin.read())/1000 ) )'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment