Master programming syntax, solve interactive challenges & run live code in Syntaxis Explore Arena →
menu_book Course Curriculum (Raspberry Pi) expand_more
Raspberry Pi / Sensors & Buses

1-Wire temperature sensor

Learn 1-Wire temperature sensor in Raspberry Pi with a dedicated explanation, a concept-specific example, practical cautions, and a mastery check.

12 min read • Intermediate
raspberry-pi-022.py
python
from pathlib import Path
raw=Path('/sys/bus/w1/devices/28-000000000000/w1_slave').read_text()
t=int(raw.split('t=')[1])/1000
print(f'{t:.2f} C')
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content