.
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import Adafruit_DHT as dht
|
||||
import time as t
|
||||
import RPi.GPIO as GPIO
|
||||
|
||||
GPIO.setmode(GPIO.BOARD)
|
||||
capteur = dht.DHT11
|
||||
pin = 22
|
||||
|
||||
while True:
|
||||
def lire_temperature():
|
||||
humidite, temperature = dht.read_retry(capteur, pin)
|
||||
|
||||
if temperature is not None:
|
||||
@@ -1,22 +1,16 @@
|
||||
import tm1637
|
||||
import time as t
|
||||
|
||||
# attention : mode BOARD
|
||||
|
||||
display = tm1637.TM1637(clk=4, dio=17)
|
||||
|
||||
display.brightness = 5
|
||||
|
||||
display.brightness(2)
|
||||
|
||||
def afficher_temperature(temperature):
|
||||
print("Test affichage...")
|
||||
|
||||
|
||||
print(f"Test affichage: {temperature}")
|
||||
try:
|
||||
while True:
|
||||
display.show(temperature)
|
||||
print(temperature)
|
||||
t.sleep(2)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
display.show("----")
|
||||
print("Stop")
|
||||
temp_entiere = int(temperature)
|
||||
texte_ecran = f"{temp_entiere} C"
|
||||
display.show(texte_ecran)
|
||||
|
||||
except Exception as e:
|
||||
print(f"Erreur d'affichage : {e}")
|
||||
@@ -9,7 +9,7 @@ GPIO.setwarnings(False)
|
||||
class SystemeThermostat:
|
||||
def __init__(self):
|
||||
self.capteur = Adafruit_DHT.DHT11
|
||||
self.pinDht = 22
|
||||
self.pinDht = 25
|
||||
|
||||
self.boutonPlus = 16
|
||||
self.boutonMoins = 18
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import tm1637
|
||||
import time as t
|
||||
|
||||
# attention : mode BOARD
|
||||
display = tm1637.TM1637(clk=7, dio=11)
|
||||
|
||||
display.brightness(2)
|
||||
|
||||
print("Test affichage...")
|
||||
|
||||
try:
|
||||
while True:
|
||||
display.show("1234")
|
||||
print("1234")
|
||||
t.sleep(2)
|
||||
|
||||
display.show("0000")
|
||||
print("0000")
|
||||
t.sleep(2)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
display.show("----")
|
||||
print("Stop")
|
||||
Reference in New Issue
Block a user