MCPcopy Create free account
hub / github.com/DexterInd/GoPiGo3 / __init__

Method __init__

Software/Python/easysensors.py:1612–1634  ·  view source on GitHub ↗

Constructor for creating a :py:class:`~easysensors.DHTSensor` object which can be used for interfacing with the `Grove DHT Sensor`_. :param easygopigo3.EasyGoPiGo3 gpg = None: Object that's required for instantianting a :py:class:`~easysensors.DHTSensor` object. :param int

(self, gpg=None, sensor_type=0, use_mutex=False)

Source from the content-addressed store, hash-verified

1610 """
1611
1612 def __init__(self, gpg=None, sensor_type=0, use_mutex=False):
1613 """
1614 Constructor for creating a :py:class:`~easysensors.DHTSensor` object which can be used for interfacing with the `Grove DHT Sensor`_.
1615
1616 :param easygopigo3.EasyGoPiGo3 gpg = None: Object that's required for instantianting a :py:class:`~easysensors.DHTSensor` object.
1617 :param int sensor_type = 0: Choose ``sensor_type = 0`` when you have the blue-coloured DHT sensor or ``sensor_type = 1`` when it's white.
1618 :param bool use_mutex = False: When using multiple threads/processes that access the same resource/device, mutexes have to be used.
1619 :raises: Any of the :py:class:`~easysensors.Sensor` constructor's exceptions in case of error.
1620
1621 """
1622
1623 self.sensor_type = sensor_type
1624 port = "SERIAL"
1625
1626 if self.sensor_type == 0:
1627 self.set_descriptor("Blue DHT Sensor")
1628 else:
1629 self.set_descriptor("White DHT Sensor")
1630
1631 try:
1632 Sensor.__init__(self,port,"INPUT",gpg, use_mutex)
1633 except:
1634 raise
1635
1636
1637 def read_temperature(self):

Callers

nothing calls this directly

Calls 2

set_descriptorMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected