Je me permets de venir demander de l'aide
Je m'explique.
J'ai un RPI 3B+ / une carte 16 relais de chez KUBII alimenté en externe avec GND en commun du RPI / 2 détecteur de mouvement / 14 bandes LED alimentées par un transfo adapté
J'ai essayer de trouver/créer un script python (les autres types je ne me suis pas encore aventuré) pour avoir les scénarios suivant:
Passage devant le capteur bas > allumage des marches (chaque marche est alimenté par un des relais de la carte 16) sens montant > attente un délai T (je pense 30s) > extinction des marches dans le sens montant
Passage devant le capteur haut> allumage des marches sens descendant > attente un délai T (je pense 30s) > extinction des marches dans le sens descendant
Malheuresement je n'arrive a rien.
Les "print" fonctionnent nickel, mais pas de fonctionnement progressif des relais, même pas les led des relais. RIEN.
Code : Tout sélectionner
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
PIR = 20
GPIO.setup(PIR, GPIO.IN)
# liste des pin en sorties
pinOut = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
# passage des pin en sorties en etat haut
for i in pinOut:
GPIO.setup(i, GPIO.OUT)
GPIO.output(i, GPIO.LOW)
# temps attente entre marche
SleepTimeL = 0.5
SleepTimeM = 5
try:
print("PIR Module Test")
print(" (CTRL+C to exit)")
time.sleep(1)
print "Ready"
while True:
if GPIO.input(PIR):
print("Motion detected! ")
GPIO.output(15, GPIO.HIGH)
print "GARDE CORPS OK"
time.sleep(SleepTimeL);
GPIO.output(2, GPIO.HIGH)
print "MARCHE 1 OK"
time.sleep(SleepTimeL);
GPIO.output(3, GPIO.HIGH)
print "MARCHE 2 OK"
time.sleep(SleepTimeL);
GPIO.output(4, GPIO.HIGH)
print "MARCHE 3 OK"
time.sleep(SleepTimeL);
GPIO.output(5, GPIO.HIGH)
print "MARCHE 4 OK"
time.sleep(SleepTimeL);
GPIO.output(6, GPIO.HIGH)
print "MARCHE 5 OK"
time.sleep(SleepTimeL);
GPIO.output(7, GPIO.HIGH)
print "MARCHE 6 OK"
time.sleep(SleepTimeL);
GPIO.output(8, GPIO.HIGH)
print "MARCHE 7 OK"
time.sleep(SleepTimeL);
GPIO.output(9, GPIO.HIGH)
print "MARCHE 8 OK"
time.sleep(SleepTimeL);
GPIO.output(10, GPIO.HIGH)
print "MARCHE 9 OK"
time.sleep(SleepTimeL);
GPIO.output(11, GPIO.HIGH)
print "MARCHE 10 OK"
time.sleep(SleepTimeL);
GPIO.output(12, GPIO.HIGH)
print "MARCHE 11 OK"
time.sleep(SleepTimeL);
GPIO.output(13, GPIO.HIGH)
print "MARCHE 12 OK"
time.sleep(SleepTimeL);
GPIO.output(14, GPIO.HIGH)
print "MARCHE 13 OK"
time.sleep(SleepTimeM);
GPIO.output(15, GPIO.HIGH)
print "GARDE CORPS OFF"
time.sleep(SleepTimeL);
GPIO.output(2, GPIO.LOW)
print "MARCHE 1 OFF"
time.sleep(SleepTimeL);
GPIO.output(3, GPIO.LOW)
print "MARCHE 2 OFF"
time.sleep(SleepTimeL);
GPIO.output(4, GPIO.LOW)
print "MARCHE 3 OFF"
time.sleep(SleepTimeL);
GPIO.output(5, GPIO.LOW)
print "MARCHE 4 OFF"
time.sleep(SleepTimeL);
GPIO.output(6, GPIO.LOW)
print "MARCHE 5 OFF"
time.sleep(SleepTimeL);
GPIO.output(7, GPIO.LOW)
print "MARCHE 6 OFF"
time.sleep(SleepTimeL);
GPIO.output(8, GPIO.LOW)
print "MARCHE 7 OFF"
time.sleep(SleepTimeL);
GPIO.output(9, GPIO.LOW)
print "MARCHE 8 OFF"
time.sleep(SleepTimeL);
GPIO.output(10, GPIO.LOW)
print "MARCHE 9 OFF"
time.sleep(SleepTimeL);
GPIO.output(11, GPIO.LOW)
print "MARCHE 10 OFF"
time.sleep(SleepTimeL);
GPIO.output(12, GPIO.LOW)
print "MARCHE 11 OFF"
time.sleep(SleepTimeL);
GPIO.output(13, GPIO.LOW)
print "MARCHE 12 OFF"
time.sleep(SleepTimeL);
GPIO.output(14, GPIO.LOW)
print "MARCHE 13 OFF"
time.sleep(10)
time.sleep(0.1)
except KeyboardInterrupt:
print("Quitting")
GPIO.cleanup()
ci joint une photo du montage à blanc
Merci à vous