Return the temperature and humidity. :returns: The temperature and humidity as a tuple, where the temperature is the 1st element of the tuple and the humidity the 2nd. :rtype: (float, float) If the sensor isn't plugged in, a ``"Bad reading, try again"`` message is
(self)
| 1694 | return humidity |
| 1695 | |
| 1696 | def read(self): |
| 1697 | """ |
| 1698 | Return the temperature and humidity. |
| 1699 | |
| 1700 | :returns: The temperature and humidity as a tuple, where the temperature is the 1st element of the tuple and the humidity the 2nd. |
| 1701 | :rtype: (float, float) |
| 1702 | |
| 1703 | If the sensor isn't plugged in, a ``"Bad reading, try again"`` message is returned. |
| 1704 | If there is a runtime error, then a ``"Runtime error"`` message is returned. |
| 1705 | |
| 1706 | """ |
| 1707 | from di_sensors import DHT |
| 1708 | |
| 1709 | _ifMutexAcquire(self.use_mutex) |
| 1710 | try: |
| 1711 | [temp, humidity]=DHT.dht(self.sensor_type) |
| 1712 | except Exception: |
| 1713 | raise |
| 1714 | finally: |
| 1715 | _ifMutexRelease(self.use_mutex) |
| 1716 | |
| 1717 | if temp ==-2.0 or humidity == -2.0: |
| 1718 | return "Bad reading, try again" |
| 1719 | elif temp ==-3.0 or humidity == -3.0: |
| 1720 | return "Runtime error" |
| 1721 | else: |
| 1722 | return [temp, humidity] |
| 1723 | |
| 1724 | |
| 1725 | def LineFollower(port="I2C", gpg=None, use_mutex=False): |
nothing calls this directly
no test coverage detected