diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..24ee5b1 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.13 diff --git a/main.py b/main.py new file mode 100644 index 0000000..07d3531 --- /dev/null +++ b/main.py @@ -0,0 +1,21 @@ +import adafruit_dht +import time +import board +def main(): + dht_device = adafruit_dht.DHT22(board.D4) + + while True: + try: + temperature_c = dht_device.temperature + temperature_f = temperature_c * (9 / 5) + 32 + humidity = dht_device.humidity + + print("Temp:{:.1f} C / {:.1f} F Humidity: {}%".format(temperature_c, temperature_f, humidity)) + except RuntimeError as err: + print(err.args[0]) + + time.sleep(2.0) + + +if __name__ == "__main__": + main() diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..91254f5 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,10 @@ +[project] +name = "dht22" +version = "0.1.0" +description = "Add your description here" +readme = "README.md" +requires-python = ">=3.13" +dependencies = [ + "adafruit-circuitpython-dht>=4.0.10", + "lgpio>=0.2.2.0", +]