erster lauffähiger Versuch.

This commit is contained in:
2026-01-06 11:22:11 +01:00
parent adc9591aa7
commit 5278985170
3 changed files with 32 additions and 0 deletions

1
.python-version Normal file
View File

@@ -0,0 +1 @@
3.13

21
main.py Normal file
View File

@@ -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()

10
pyproject.toml Normal file
View File

@@ -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",
]