MakeCode for the DS1820 / DS18B20 Temperature sensor.
- Connect the appropriate pins (GND, V, S) to the micro:bit.
- Connect a resistor (10kΩ can do) across the V and S pins to pull the signal high. (The micro:bit's internal pull-up doesn't work, for some reason.)
- Initialise with the
connect temperature probe
block inon start
. - Get your reading from the
temperature
variable. - Note that the temperature is 10x the actual temperature, in degrees celsius. 30.5°C would hence show 305.
- for PXT/microbit