UART & Sensors
Build, push image, and notify Watchtower / build-image (push) Successful in 1m39s
Build, push image, and notify Watchtower / notify (push) Successful in 1m43s

This commit is contained in:
2026-07-23 15:50:43 +02:00
parent 1ec3ee7abf
commit 2dd664c4b4
25 changed files with 2333 additions and 71 deletions
+52
View File
@@ -0,0 +1,52 @@
# from sensors.lib import grove_i2c_temp_hum_mini
# t= grove_i2c_temp_hum_mini.th02()
# def get_temperature():
# """Get the temperature in Celsius from the TH02 sensor."""
# # try:
# return t.getTemperature()
# # except Exception as e:
# # print(f"Error reading temperature: {e}")
# # return None
# def get_humidity():
# """Get the humidity in percentage from the TH02 sensor."""
# # try:
# return t.getHumidity()
# # except Exception as e:
# # print(f"Error reading humidity: {e}")
# # return None
# import seeed_dht
# sensor = seeed_dht.DHT("11", 4) # DHT11 sensor on GPIO pin 4
# def get_humidity_and_temperature():
# humi, temp = sensor.read()
# return humi, temp
# import sensors.lib.grovepi as grovepi
import grovepi
import math
from sensors.lock import grove_lock
# Connect the Grove Temperature & Humidity Sensor Pro to digital port D3
# This example uses the blue colored sensor.
# SIG,NC,VCC,GND
sensor = 3 # The Sensor goes on digital port 3.
# temp_humidity_sensor_type
# Grove Base Kit comes with the blue sensor.
blue = 0 # The Blue colored sensor.
white = 1 # The White colored sensor.
def get_temperature_and_humidity():
with grove_lock:
[temp,humidity] = grovepi.dht(sensor,blue)
if math.isnan(temp) == False and math.isnan(humidity) == False:
return temp, humidity
else:
print("Error reading from DHT sensor")
return None, None