Boite aux lettres intelligente : Différence entre versions
Ligne 28 : | Ligne 28 : | ||
== '''le code arduino'''== | == '''le code arduino'''== | ||
+ | |||
+ | |||
+ | |||
+ | <pre>#include<LiquidCrystal.h> | ||
+ | LiquidCrystal lcd(8,9,4,5,6,7); | ||
+ | char TRIGGER=12; | ||
+ | char ECHO=13; | ||
+ | float distance; | ||
+ | void setup() { | ||
+ | Serial.begin(9600); | ||
+ | pinMode(TRIGGER,OUTPUT); | ||
+ | pinMode(ECHO,INPUT); | ||
+ | } | ||
+ | |||
+ | void loop() | ||
+ | { | ||
+ | digitalWrite(TRIGGER,LOW); | ||
+ | delayMicroseconds(2); | ||
+ | digitalWrite(TRIGGER,HIGH); | ||
+ | delayMicroseconds(10); | ||
+ | digitalWrite(TRIGGER,LOW); | ||
+ | |||
+ | distance=pulseIn(ECHO,HIGH)/58; | ||
+ | |||
+ | lcd.setCursor(0,0); | ||
+ | Serial.print("La Distance est "); | ||
+ | lcd.setCursor(0,1); | ||
+ | Serial.print(distance); | ||
+ | Serial.println("cm"); | ||
+ | delay(1000); | ||
+ | Ham ZA | ||
+ | #include <LiquidCrystal.h> | ||
+ | LiquidCrystal lcd(8, 9, 4,5,6,7); | ||
+ | int valeur=A0; | ||
+ | int valeur1=9,i,t; | ||
+ | int led=13; | ||
+ | int buzz=8; | ||
+ | void setup() { | ||
+ | pinMode(valeur,INPUT); | ||
+ | pinMode(valeur1,OUTPUT); | ||
+ | pinMode(led,OUTPUT); | ||
+ | Serial.begin(9600); | ||
+ | lcd.begin(16, 2); | ||
+ | Serial.print(""); | ||
+ | } | ||
+ | |||
+ | void loop() | ||
+ | { | ||
+ | |||
+ | digitalWrite(valeur1,HIGH); | ||
+ | digitalWrite(led,LOW); | ||
+ | //for(i=0;i<10;i++){ | ||
+ | lcd.setCursor(0,1); | ||
+ | lcd.print(analogRead(valeur)); | ||
+ | if(analogRead(valeur)<1023){ | ||
+ | |||
+ | lcd.clear(); | ||
+ | lcd.setCursor(0,0); | ||
+ | lcd.print(analogRead(valeur)); | ||
+ | Serial.print(analogRead(valeur)); | ||
+ | lcd.print(" nouvelle lettre"); | ||
+ | Serial.print(" nouvelle lettre"); | ||
+ | tone(buzz,700,300); | ||
+ | |||
+ | digitalWrite(led,HIGH); | ||
+ | delay(200); | ||
+ | // tone(buzz,0,0); | ||
+ | digitalWrite(led,LOW); | ||
+ | delay(1000); | ||
+ | |||
+ | lcd.clear(); | ||
+ | //digitalWrite(led,LOW); | ||
+ | |||
+ | } | ||
+ | else | ||
+ | lcd.print("aucune nouvelle lettre"); | ||
+ | Serial.print("aucune nouvelle lettre"); | ||
+ | Serial.print(analogRead(valeur)); | ||
+ | } | ||
+ | Ham ZA | ||
+ | #include <LiquidCrystal.h> | ||
+ | LiquidCrystal lcd(8, 9, 4,5,6,7); | ||
+ | |||
+ | int i,t; | ||
+ | int led=A5; | ||
+ | int led1=A4; | ||
+ | int buzz=A3; | ||
+ | char TRIGGER=12; | ||
+ | char ECHO=13; | ||
+ | float distance; | ||
+ | void setup() { | ||
+ | |||
+ | |||
+ | pinMode(led,OUTPUT); | ||
+ | pinMode(led1,OUTPUT); | ||
+ | Serial.begin(9600); | ||
+ | lcd.begin(16, 2); | ||
+ | Serial.print(""); | ||
+ | } | ||
+ | |||
+ | void loop() | ||
+ | { | ||
+ | digitalWrite(TRIGGER,LOW); | ||
+ | delayMicroseconds(2); | ||
+ | digitalWrite(TRIGGER,HIGH); | ||
+ | delayMicroseconds(10); | ||
+ | digitalWrite(TRIGGER,LOW); | ||
+ | |||
+ | distance=pulseIn(ECHO,HIGH)/58; | ||
+ | digitalWrite(led,LOW); | ||
+ | digitalWrite(led1,LOW); | ||
+ | //for(i=0;i<10;i++){ | ||
+ | |||
+ | if(distance<19){ | ||
+ | |||
+ | lcd.clear(); | ||
+ | lcd.setCursor(0,0); | ||
+ | //lcd.print(distance); | ||
+ | Serial.print(distance); | ||
+ | lcd.print("Nouvelle lettre"); | ||
+ | Serial.print(" nouvelle lettre"); | ||
+ | lcd.setCursor(2,1); | ||
+ | lcd.print("dans la boite"); | ||
+ | |||
+ | tone(buzz,700,300); | ||
+ | digitalWrite(led,HIGH); | ||
+ | digitalWrite(led1,LOW); | ||
+ | delay(200); | ||
+ | digitalWrite(led,LOW); | ||
+ | digitalWrite(led1,HIGH); | ||
+ | delay(1000); | ||
+ | lcd.clear(); | ||
+ | //digitalWrite(led,LOW); | ||
+ | |||
+ | } | ||
+ | else | ||
+ | lcd.clear(); | ||
+ | lcd.setCursor(0,0); | ||
+ | lcd.print("aucune nouvelle"); | ||
+ | lcd.setCursor(3,1); | ||
+ | lcd.print("lettre"); | ||
+ | Serial.print("aucune nouvelle lettre"); | ||
+ | //Serial.print(distance); | ||
+ | //lcd.print(distance); | ||
+ | } <pre> | ||
[[Média:CODE.zip]] | [[Média:CODE.zip]] | ||
[[catégorie:enib2018]] | [[catégorie:enib2018]] |
Version du 22 janvier 2018 à 14:33
Vous aussi vous en avez marre de devoir faire des allers-retours à votre boîte aux lettres pour voir si le facteur est passé juste parce que vous attendez une lettre importante ? C'est pour cela qu'on a pensé à une solution pour la rendre communicante , afin qu’elle puisse informer l'habitant lors de l'arrivée d'une lettre.
Membres du groupe
Yahya fatima ezzahra
Touaf Hamza
Elkanit rajaa
Tizliouine fayssal
Haddadi zohra
Zaoui fatima zahra
Lazizi Omar
Mondher Nassim
Khalfi Fatima zahra
Liste des materiaux
Arduino
Capteur
Afficheur LCD
Boite
Buzzer
Présentation
presentation.odp [1]
le code arduino
#include<LiquidCrystal.h> LiquidCrystal lcd(8,9,4,5,6,7); char TRIGGER=12; char ECHO=13; float distance; void setup() { Serial.begin(9600); pinMode(TRIGGER,OUTPUT); pinMode(ECHO,INPUT); } void loop() { digitalWrite(TRIGGER,LOW); delayMicroseconds(2); digitalWrite(TRIGGER,HIGH); delayMicroseconds(10); digitalWrite(TRIGGER,LOW); distance=pulseIn(ECHO,HIGH)/58; lcd.setCursor(0,0); Serial.print("La Distance est "); lcd.setCursor(0,1); Serial.print(distance); Serial.println("cm"); delay(1000); Ham ZA #include <LiquidCrystal.h> LiquidCrystal lcd(8, 9, 4,5,6,7); int valeur=A0; int valeur1=9,i,t; int led=13; int buzz=8; void setup() { pinMode(valeur,INPUT); pinMode(valeur1,OUTPUT); pinMode(led,OUTPUT); Serial.begin(9600); lcd.begin(16, 2); Serial.print(""); } void loop() { digitalWrite(valeur1,HIGH); digitalWrite(led,LOW); //for(i=0;i<10;i++){ lcd.setCursor(0,1); lcd.print(analogRead(valeur)); if(analogRead(valeur)<1023){ lcd.clear(); lcd.setCursor(0,0); lcd.print(analogRead(valeur)); Serial.print(analogRead(valeur)); lcd.print(" nouvelle lettre"); Serial.print(" nouvelle lettre"); tone(buzz,700,300); digitalWrite(led,HIGH); delay(200); // tone(buzz,0,0); digitalWrite(led,LOW); delay(1000); lcd.clear(); //digitalWrite(led,LOW); } else lcd.print("aucune nouvelle lettre"); Serial.print("aucune nouvelle lettre"); Serial.print(analogRead(valeur)); } Ham ZA #include <LiquidCrystal.h> LiquidCrystal lcd(8, 9, 4,5,6,7); int i,t; int led=A5; int led1=A4; int buzz=A3; char TRIGGER=12; char ECHO=13; float distance; void setup() { pinMode(led,OUTPUT); pinMode(led1,OUTPUT); Serial.begin(9600); lcd.begin(16, 2); Serial.print(""); } void loop() { digitalWrite(TRIGGER,LOW); delayMicroseconds(2); digitalWrite(TRIGGER,HIGH); delayMicroseconds(10); digitalWrite(TRIGGER,LOW); distance=pulseIn(ECHO,HIGH)/58; digitalWrite(led,LOW); digitalWrite(led1,LOW); //for(i=0;i<10;i++){ if(distance<19){ lcd.clear(); lcd.setCursor(0,0); //lcd.print(distance); Serial.print(distance); lcd.print("Nouvelle lettre"); Serial.print(" nouvelle lettre"); lcd.setCursor(2,1); lcd.print("dans la boite"); tone(buzz,700,300); digitalWrite(led,HIGH); digitalWrite(led1,LOW); delay(200); digitalWrite(led,LOW); digitalWrite(led1,HIGH); delay(1000); lcd.clear(); //digitalWrite(led,LOW); } else lcd.clear(); lcd.setCursor(0,0); lcd.print("aucune nouvelle"); lcd.setCursor(3,1); lcd.print("lettre"); Serial.print("aucune nouvelle lettre"); //Serial.print(distance); //lcd.print(distance); } <pre> Média:CODE.zip