class DS18X20 - ds18x20 series temperature sensorΒΆ

Usage

from robot_hat import Pin, DS18X20

pin = Pin("D0")             # create pin object
ds = DS18X20(pin)           # create a DS18X20 object

ds.read(ds.C)               # read temperature in celsius(1)
ds.read(0)                  # read temperature in Fahrenheit(0)

Constructors

class robot_hat.DS18X20(pin): Create a DS18X20 object associated with the given pin object. This allows you to read temperature from DS18X20.

Methods

  • DS18X20.read - Read temperature with the giving unit. It returns a float value if only one ds18x20 is connected to the pin, or it will return a list of all sensor values.

DS18X20.read(unit)
  • DS18X20.scan - Scan the connected DS18X20 and return the roms address list.

DS18X20.scan()
  • DS18X20.read_temp - Read temperature(s) with the giving rom(s).

DS18X20.read_temp(rom)

Constants

  • DS18X20.C - Celsius

  • DS18X20.F - Fahrenheit