PyRaspBeta

← All practice problems

Raspberry Pi practice problem · Sensors

Highs and lows

MediumBudget $7Python · gpiozero

A DS18B20 on GPIO4 with a 4.7 kΩ pull-up (or the probe module). About once a second, print the current temperature and the lowest and highest seen since start-up, each with one decimal:

now 21.0 min 21.0 max 21.0

Read it from /sys/bus/w1/devices/28-*/w1_slave (the t= value is in thousandths of a degree; each read takes 0.75 s). The test starts at 21 °C, warms to 25 °C at 2.5 s, cools to 18.5 °C at 5.5 s and settles at 22 °C at 8.5 s.

More in Sensors