Capture222
Capture222


DESCRIPTION

La pancarte détecte tous les mouvements et déclenche un message.


Matériaux

-Arduino

-LCD screen

-Ultra sonic sensor

- passive Buzzer

Code

// include the library code:

#include <LiquidCrystal.h>

// initialize the library by associating any needed LCD interface pin

// with the arduino pin number it is connected to

const int rs = 6, en = 7, d4 = 5, d5 = 4, d6 = 3, d7 = 2;

LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

const int buzzer = 11;

// defines pins numbers

const int trigPin = 9;

const int echoPin = 10;

int j =0;

const int Pinbuzzer = 11;

// defines variables

long duration;

int distance;

int safetyDistance;

void setup(){

// set up the LCD's number of columns and rows:

lcd.begin(16, 2);

pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output

pinMode(echoPin, INPUT); // Sets the echoPin as an Input

pinMode(buzzer, OUTPUT);

Serial.begin(9600); // Starts the serial communication

}

void loop()

{

// Clears the trigPin

digitalWrite(trigPin, LOW);

delayMicroseconds(2);

// Sets the trigPin on HIGH state for 10 micro seconds

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

// Reads the echoPin, returns the sound wave travel time in microseconds

duration = pulseIn(echoPin, HIGH);

// Calculating the distance

distance= duration*0.034/2;

safetyDistance = distance;

if (safetyDistance <= 20){

/*digitalWrite(buzzer, HIGH);*/

lcd.setCursor(0,0);

lcd.print("S'il vous plait");

delay(1000);

lcd.clear();

lcd.setCursor(0,0);

lcd.print("pour votre ");

lcd.setCursor(0,1);

lcd.print("securite");

delay(2000);

lcd.clear();

lcd.setCursor(0,0);

lcd.print("Veuillez quitter");

lcd.setCursor(0,1);

lcd.print("la mediane");

delay(1000);

lcd.clear();

j=++j;

distance= duration*0.034/2;

}

if(j==2)

{

do

{

lcd.setCursor(0,0);

lcd.print("C'est dangereux");

lcd.setCursor(0,1);

lcd.print("Quitter ce lieu");

delay(3000);

digitalWrite(Pinbuzzer, HIGH);

delay(3000);

digitalWrite(Pinbuzzer,LOW);

jaime=0;

duration = pulseIn(echoPin, HIGH);

distance= duration*0.034/2;

lcd.clear();

}while (safetyDistance > 20);

}

else

{

if(distance>20);

{

lcd.setCursor(0,0);

lcd.print("Interesse aux");

lcd.setCursor(0,1);

lcd.print("etudes Superieur?");

delay(2000);

lcd.clear();

lcd.setCursor(0,0);

lcd.print("Uottawa est la");

lcd.setCursor(0,1);

lcd.print("place pour vous");

delay(3000);

lcd.clear();

duration = pulseIn(echoPin, HIGH);

distance= duration*0.034/2;

}

}

}

Pancarte B4
0 0
PROJECT BY
PUBLISHED ON
Apr 4 2018
CATEGORIES
GNG1103/GNG1503
Linked to Project Proposal:
None
Comments