Created
June 1, 2017 17:29
-
-
Save sourceperl/ab5b8d5596a8d7eedc416908ff5e0e2d to your computer and use it in GitHub Desktop.
Temperature from DS18B20 on a Raspberry Pi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# read DS18B20 (default is data connect on GPIO4) | |
# add 'dtoverlay=w1-gpio' to /boot/config.txt to load one-wire device tree and reboot | |
# test on Rpi with Raspbian Jessie | |
while [ true ] | |
do | |
cat /sys/bus/w1/devices/28-0000040de8f8/w1_slave | grep 't=' | awk -F 't=' '{printf("%.2f\n", $2/1000)}' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment