Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Removed dht function
  • Loading branch information
mkals committed May 8, 2019
commit 4e5e0f8cc23d520050618c7d053ea80b8b8a0719
51 changes: 0 additions & 51 deletions Arduino/arduino.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,57 +448,6 @@ def shiftIn(self, dataPin, clockPin, pinOrder):
return int(rd)


def dht(self, pin, module = 0):
"""
Read data from dht temperature and humidity sensors based on the
Adafruit DHT sensor library.
https://github.com/adafruit/DHT-sensor-library

Guide for using library:
https://learn.adafruit.com/dht/using-a-dhtxx-sensor

There are five sensors that work with this library:
- DHT 11: blue cage, less accurate
- DHT 12:
- DHT 21:
- DHT 22: white cage
- AM2301:
Input:
pin (int): pin for data
module (int): 0 = DHT 11 (default),
1 = DHT 12,
2 = DHT 21,
3 = DHT 22,
4 = AM2301
Output:
[float, float, float] in the format:
[ humidity in %,
temperature in celcius,
heat index in celcius ]
"""
try:
if not (0 <= module <= 4):
print("unknown module, must be in range 0 to 4. Using 0 (DHT 11).") # raise exception
except:
module = 0
print("module must be spesified using an integer. Using 0 (DHT 11).")

cmd_str = build_cmd_str("dht", (pin, module,))
try:
self.sr.write(str.encode(cmd_str))
self.sr.flush()
except:
pass
rd = self.sr.readline().decode("utf-8").replace("\r\n", "")
try:
strings = rd.split("&")
return [float(s) for s in strings]
except:
return None




class Shrimp(Arduino):

def __init__(self):
Expand Down