Skip to content

DFRobot/pxt-ds18b20

Repository files navigation

DS18B20 Temperature Sensor for Microbit

Table of Contents

Summary

DS18B20 module, support single bus control, and read temperature.

Blocks

Read temperature, return a number, makecode do not support floats, so the value is amplifies up to 100 times.

image

Read temperature, return a string.

image

Example

Example for JavaScript

basic.forever(() => {
    serial.writeValue("temp ", DS18B20.TemperatureNumber(DS18B20.pin.pin0))
    basic.pause(1000)
    serial.writeLine("temp : " + DS18B20.TemperatureString(DS18B20.pin.pin0))
    basic.pause(1000)
})

License

GUI

Supported targets

  • for PXT/microbit (The metadata above is needed for package search.)