wallah pardon sur le coran de l eglise c'est pas de ma faute
This commit is contained in:
23
composants/test/7segments.py
Normal file
23
composants/test/7segments.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
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")
|
||||||
15
composants/test/DHT11.py
Normal file
15
composants/test/DHT11.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import Adafruit_DHT as dht
|
||||||
|
import time as t
|
||||||
|
|
||||||
|
capteur = dht.DHT11
|
||||||
|
pin = 22
|
||||||
|
|
||||||
|
while True:
|
||||||
|
humidite, temperature = dht.read_retry(capteur, pin)
|
||||||
|
|
||||||
|
if temperature is not None:
|
||||||
|
print("Temp :", temperature, "°C")
|
||||||
|
else:
|
||||||
|
print("Erreur")
|
||||||
|
|
||||||
|
t.sleep(2)
|
||||||
15
composants/test/PIR.py
Normal file
15
composants/test/PIR.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import RPi.GPIO as GPIO
|
||||||
|
import time as t
|
||||||
|
|
||||||
|
GPIO.setmode(GPIO.BOARD)
|
||||||
|
|
||||||
|
pir = 10
|
||||||
|
GPIO.setup(pir, GPIO.IN)
|
||||||
|
|
||||||
|
print("Stabilisation...")
|
||||||
|
t.sleep(10)
|
||||||
|
print("Stabilisation terminée")
|
||||||
|
|
||||||
|
while True:
|
||||||
|
print("PIR :", GPIO.input(pir))
|
||||||
|
t.sleep(0.5)
|
||||||
27
composants/test/ledPorte.py
Normal file
27
composants/test/ledPorte.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import RPi.GPIO as GPIO
|
||||||
|
import time as t
|
||||||
|
|
||||||
|
GPIO.setmode(GPIO.BOARD)
|
||||||
|
GPIO.setwarnings(False)
|
||||||
|
|
||||||
|
ledPorte = 7
|
||||||
|
|
||||||
|
GPIO.setup(ledPorte, GPIO.OUT)
|
||||||
|
|
||||||
|
print("Test LED porte...")
|
||||||
|
|
||||||
|
try:
|
||||||
|
while True:
|
||||||
|
GPIO.output(ledPorte, GPIO.HIGH)
|
||||||
|
print("LED ON")
|
||||||
|
t.sleep(1)
|
||||||
|
|
||||||
|
GPIO.output(ledPorte, GPIO.LOW)
|
||||||
|
print("LED OFF")
|
||||||
|
t.sleep(1)
|
||||||
|
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("Stop")
|
||||||
|
|
||||||
|
finally:
|
||||||
|
GPIO.output(ledPorte, GPIO.LOW)
|
||||||
15
composants/test/ledRGB.py
Normal file
15
composants/test/ledRGB.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import RPi.GPIO as GPIO
|
||||||
|
import time as t
|
||||||
|
|
||||||
|
GPIO.setmode(GPIO.BOARD)
|
||||||
|
|
||||||
|
r, g, b = 11, 13, 15
|
||||||
|
|
||||||
|
GPIO.setup(r, GPIO.OUT)
|
||||||
|
GPIO.setup(g, GPIO.OUT)
|
||||||
|
GPIO.setup(b, GPIO.OUT)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
GPIO.output(r, 1); t.sleep(1); GPIO.output(r, 0)
|
||||||
|
GPIO.output(g, 1); t.sleep(1); GPIO.output(g, 0)
|
||||||
|
GPIO.output(b, 1); t.sleep(1); GPIO.output(b, 0)
|
||||||
15
composants/test/rfid.py
Normal file
15
composants/test/rfid.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
from mfrc522 import SimpleMFRC522 as RFIDReader
|
||||||
|
|
||||||
|
reader = RFIDReader()
|
||||||
|
|
||||||
|
print("En attente...")
|
||||||
|
|
||||||
|
try:
|
||||||
|
while True:
|
||||||
|
badgeId, text = reader.read()
|
||||||
|
print("ID :", badgeId)
|
||||||
|
print("Texte :", text)
|
||||||
|
print("-----")
|
||||||
|
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("Stop")
|
||||||
19
composants/test/servo.py
Normal file
19
composants/test/servo.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import RPi.GPIO as GPIO
|
||||||
|
import time as t
|
||||||
|
|
||||||
|
GPIO.setmode(GPIO.BOARD)
|
||||||
|
|
||||||
|
servo = 12
|
||||||
|
GPIO.setup(servo, GPIO.OUT)
|
||||||
|
|
||||||
|
pwm = GPIO.PWM(servo, 50)
|
||||||
|
pwm.start(0)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
print("Position 1")
|
||||||
|
pwm.ChangeDutyCycle(2)
|
||||||
|
t.sleep(2)
|
||||||
|
|
||||||
|
print("Position 2")
|
||||||
|
pwm.ChangeDutyCycle(7)
|
||||||
|
t.sleep(2)
|
||||||
Reference in New Issue
Block a user