maj vers BCM

This commit is contained in:
2026-03-31 20:09:26 +02:00
parent c378be1695
commit bf5b24214c
3 changed files with 23 additions and 14 deletions

View File

@@ -1,13 +1,13 @@
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
class EtatSysteme:
def __init__(self):
self.pinLedRouge = 35
self.pinLedVerte = 37
self.pinLedRouge = 19
self.pinLedVerte = 26
GPIO.setup(self.pinLedRouge, GPIO.OUT, initial=GPIO.LOW)
GPIO.setup(self.pinLedVerte, GPIO.OUT, initial=GPIO.LOW)

View File

@@ -1,7 +1,7 @@
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
@@ -12,9 +12,9 @@ class SystemeLumieres:
# elle apparaîtra peut-être un jour, comme la motivation en fin de projet
self.pinPhotoInterieure = 29
self.led1 = 21
self.led2 = 31
self.led3 = 33
self.led1 = 6
self.led2 = 9
self.led3 = 13
self.boutonManuel = 36

View File

@@ -1,22 +1,31 @@
import RPi.GPIO as GPIO
import time as t
GPIO.setmode(GPIO.BOARD)
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
ledPorte = 7
led1 = 9
led2 = 6
led3 = 13 # example BCM pin
GPIO.setup(ledPorte, GPIO.OUT)
GPIO.setup(led1, GPIO.OUT)
GPIO.setup(led2, GPIO.OUT)
GPIO.setup(led3, GPIO.OUT)
print("Test LED porte...")
print("Test LEDs...")
try:
while True:
GPIO.output(ledPorte, GPIO.HIGH)
GPIO.output(led1, GPIO.HIGH)
GPIO.output(led2, GPIO.HIGH)
GPIO.output(led3, GPIO.HIGH)
print("LED ON")
t.sleep(1)
GPIO.output(ledPorte, GPIO.LOW)
GPIO.output(led1, GPIO.LOW)
GPIO.output(led2, GPIO.LOW)
GPIO.output(led3, GPIO.LOW)
print("LED OFF")
t.sleep(1)
@@ -24,4 +33,4 @@ except KeyboardInterrupt:
print("Stop")
finally:
GPIO.output(ledPorte, GPIO.LOW)
GPIO.cleanup()