0% found this document useful (0 votes)
5 views3 pages

RT

This document contains an Arduino program that controls a servo motor and an LCD display to manage access requests. It uses buttons for access demand and validation, and indicates access status with LEDs. The program provides feedback on the LCD and operates the servo based on user input.

Uploaded by

bilalastephen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

RT

This document contains an Arduino program that controls a servo motor and an LCD display to manage access requests. It uses buttons for access demand and validation, and indicates access status with LEDs. The program provides feedback on the LCD and operates the servo based on user input.

Uploaded by

bilalastephen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

// Inclusion des bibliothèques nécessaires

#include <Servo.h>

#include <Wire.h>

#include <LiquidCrystal_I2C.h>

// Déclaration des objets et variables

Servo servoMotor;

LiquidCrystal_I2C lcd(0x27, 16, 2);

const int boutonDemande = 2;

const int boutonValidation = 3;

const int ledVerte = 5;

const int ledRouge = 6;

const int servoPin = 9;

bool accesEnCours = false;

void setup() {

servoMotor.attach(servoPin);

pinMode(boutonDemande, INPUT_PULLUP);

pinMode(boutonValidation, INPUT_PULLUP);

pinMode(ledVerte, OUTPUT);

pinMode(ledRouge, OUTPUT);

lcd.begin();

lcd.backlight();

lcd.setCursor(0, 0);

lcd.print("Welcome to Arduino");

lcd.setCursor(0, 1);

lcd.print("Demander Acces");

}
void loop() {

if (digitalRead(boutonDemande) == LOW) {

lcd.setCursor(0, 1);

lcd.print("Acces en attente");

accesEnCours = true; // Correction de True à true

digitalWrite(ledRouge, HIGH);

delay(5000);

if (digitalRead(boutonValidation) == LOW) {

lcd.setCursor(0, 1);

lcd.print("Acces Autorise ");

digitalWrite(ledVerte, HIGH);

digitalWrite(ledRouge, LOW);

servoMotor.write(90);

delay(5000);

servoMotor.write(0);

digitalWrite(ledVerte, LOW);

lcd.clear();

lcd.setCursor(0, 1);

lcd.print("Demander Acces");

} else {

lcd.setCursor(0, 1);

lcd.print("Acces Refuse ");

digitalWrite(ledRouge, HIGH);

delay(2000);

digitalWrite(ledRouge, LOW);

lcd.clear();

lcd.setCursor(0, 1);
lcd.print("Demander Acces");

accesEnCours = false; // Correction de False à false

You might also like