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 # Importation des librairies qui gerent les ports | |
import time # Importation de la librairie temps | |
GPIO.setmode(GPIO.BCM) # BCM : Numero des GPIO (GPIO 18) | |
GPIO.setup(18, GPIO.OUT) # Definition du port en sortie | |
GPIO.setwarnings(False) # Mettre sur OFF les alertes (qui sont inutiles) | |
# Affichage de texte | |
print("\n+------------------/ Blink LED /------------------+") |
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
#Ajouter les imports suivants en debut de fichier | |
from datetime import datetime, timedelta | |
import os | |
# Entree : temperature; Fonction : enregistrer la temperature dans un fichier, au bon endroit | |
def enregistrement(temperature): | |
d = datetime.now() | |
# On recupere de datetime.now l'annee & le jour et on le stocke | |
annee = str(d)[:4] | |
jour = str(d)[:10] |
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 | |
import time | |
GPIO.setmode(GPIO.BCM) | |
print "+-----------------------------------------------------------+" | |
print "| Mesure de distance par le capteur ultrasonore HC-SR04 |" | |
print "+-----------------------------------------------------------+" | |
Trig = 23 # Entree Trig du HC-SR04 branchee au GPIO 23 |
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 | |
import time | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(17, GPIO.OUT) | |
GPIO.setwarnings(False) | |
ajoutAngle = 5 | |
print("\n+----------/ ServoMoteur Controlleur /----------+") |
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 de la librairie serial | |
import serial | |
# Ouverture du port serie avec : | |
# '/dev/ttyXXXX' : definition du port d ecoute (remplacer 'X' par le bon nom) | |
# 9600 : vitesse de communication | |
serialArduino = serial.Serial('/dev/ttyXXXX', 9600) | |
# Ecriture de chaque message recu |
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
#define Rouge A0 | |
#define Vert A1 | |
#define Bleu A2 | |
int message = 0; | |
int couleurs[] = {Rouge, Vert, Bleu}; | |
void setup() { | |
Serial.begin(9600); | |
pinMode(Rouge, OUTPUT); |
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
int i=0; | |
void setup() { | |
Serial.begin(9600); | |
Serial.println("Un message va etre envoye toutes les deux secondes des maintenant !"); | |
} | |
void loop() { | |
Serial.println("Message #" + String(i)); | |
delay(2000); |
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)) |
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
#!/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 : ")) |