A wrapper module for reading values provided by DS18X20 temperature sensor.
ds18.x20.get_reading(data_pin, vcc_pin=None)
Returns temperature reading, for DATA pin. If vcc_pin
is defined it will first power on sensors and it will power off sensors at the end.
from sensors import ds18x20
temperature = ds18x20.get_reading('P19')
data_pin
: the input pin name where the sensor data is connected to.vcc_pin
: (optional) the pin that controls the power to the sensors.temperature
: float number with temperature in CelsiusLibrary and Wrapper for DS18X20 sensor.
Extended Pycom's Example https://github.com/pycom/pycom-libraries/blob/master/examples/DS18X20/onewire.py by adding a simple wrapper function
OneWire and DS18X20 classes are used as-is from the above github link