This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from RPLCD.gpio import CharLCD | |
from time import sleep | |
lcd = CharLCD(cols=16, rows=2, pin_rs=37, pin_e=35, pins_data=[33, 31, 29, 23]) | |
def lireFichier(emplacement): | |
fichTemp = open(emplacement) | |
contenu = fichTemp.read() | |
fichTemp.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
from flask import Flask | |
import RPi.GPIO as GPIO | |
relais = 22 | |
GPIO.setmode(GPIO.BOARD) | |
GPIO.setup(relais, GPIO.OUT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPi.GPIO as GPIO | |
from time import sleep | |
relaisPin = 22 | |
GPIO.setmode(GPIO.BOARD) | |
GPIO.setup(relaisPin, GPIO.OUT) | |
while True : | |
GPIO.output(relaisPin, True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Initialisation | |
M1_Vitesse = GPIO.PWM(M1_En, frequence) | |
M1_Vitesse.start(rapportCyclique) # On entre ici un rapport cyclique entre 0 et 100 (pourcentages) | |
# Changement des valeurs | |
M1_Vitesse.ChangeFrequency(frequence) | |
M1_Vitesse.ChangeDutyCycle(rapportCyclique) | |
# Arret de la modulation | |
M1_Vitesse.stop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPi.GPIO as GPIO | |
from time import sleep | |
# Definition des pins | |
M1_En = 21 | |
M1_In1 = 20 | |
M1_In2 = 16 | |
M2_En = 18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Importation des librairies | |
import tm1637 | |
from time import sleep | |
# Definition de la reference de la sonde (remplacer les x par la ref.) | |
# Pour connaitre la ref. : | |
# sudo modprobe w1-gpio | |
# sudo modprobe w1-therm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Importation des librairies TM1637 et time | |
from tm1637 import TM1637 | |
from time import sleep, localtime | |
# Fonction appelee a l'infini pour afficher l'heure | |
def afficher_horloge(aff): | |
# Recuperation de l'heure locale et affichage sur le module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Importation des librairies TM1637 et time | |
from tm1637 import TM1637 | |
from time import sleep | |
# Stockage de la duree dans des variables | |
print("- Duree du minuteur -") | |
minutes = int(input("Minutes : ")) | |
secondes = int(input("Secondes : ")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Imports | |
import time | |
import RPi.GPIO as GPIO | |
# Definition des pins | |
pinBtn = 2 | |
led = 16 | |
GPIO.setmode(GPIO.BCM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import serial | |
ser = serial.Serial('/dev/ttyXXXX', 9600) | |
print("CTRL + C pour arrêter") | |
while True : | |
led = int(input('Quelle LED souhaitez-vous allumer / eteindre ? (Rouge=1 / Vert=2 / Bleu=3)')) | |
action = input("Souhaitez-vous allumer ou Eteindre la LED ? (Allumer=1 / Eteindre=0)") | |
if (action == 1) : | |
ser.write(str(led)) |
NewerOlder