This file contains hidden or 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 glob | |
| import time | |
| import datetime | |
| def read_file(path): | |
| file = open(path) | |
| content = file.read() | |
| file.close() | |
| return content |
This file contains hidden or 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 glob | |
| def read_file(path): | |
| # Open the file containing the temperature | |
| file = open(path) | |
| # Read the file | |
| content = file.read() | |
| # Close the file after it has been read | |
| file.close() |
This file contains hidden or 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 # Importing the libraries that manage the ports | |
| import time # Importing the time library | |
| GPIO.setmode(GPIO.BCM) # BCM: GPIO numbering (GPIO 18) | |
| GPIO.setup(18, GPIO.OUT) # Set the port as output | |
| GPIO.setwarnings(False) # Turn OFF warnings (they are unnecessary) | |
| # Display text | |
| print("\n+--------------------/ Blink LED /----------------------+") | |
| print("| |") |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
NewerOlder