erster lauffähiger Versuch.
This commit is contained in:
1
.python-version
Normal file
1
.python-version
Normal file
@@ -0,0 +1 @@
|
|||||||
|
3.13
|
||||||
21
main.py
Normal file
21
main.py
Normal 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
10
pyproject.toml
Normal 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",
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user