Driver for Dallas 1-Wire temperature sensor.
- Author(s): Carter Nelson
Software and Dependencies:
- Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
Class which provides interface to DS18X20 temperature sensor :param bus: The bus the DS18X20 is connected to :param int address: The device address.
Quickstart: Importing and using the device
Here is an example of using the
DS18X20class. First you will need to import the libraries to use the sensor
import board from adafruit_onewire.bus import OneWireBus from adafruit_ds18x20 import DS18X20
Once this is done you can define your
adafruit_onewire.bus.OneWireBusobject and define your sensor object
ow_bus = OneWireBus(board.D5) ds18 = DS18X20(ow_bus, ow_bus.scan())
Now you have access to the
temperature = ds18.temperature
Read the temperature. No polling of the conversion busy bit (assumes that the conversion has completed).
The programmable resolution. 9, 10, 11, or 12 bits.
Start asynchronous conversion, returns immediately. Returns maximum conversion delay [seconds] based on resolution.
The temperature in degrees Celsius.