[go: up one dir, main page]

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

Parking Intimator For Arduino Without Parking Irs

This document contains an Arduino code for a parking system that uses an LCD and a servo motor to manage parking slots. It utilizes two infrared sensors to detect vehicle entry and exit, updating the number of available slots accordingly. The system displays messages on the LCD to inform users about the parking status and controls the gate's position based on sensor inputs.

Uploaded by

aadityabandi5115
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)
13 views3 pages

Parking Intimator For Arduino Without Parking Irs

This document contains an Arduino code for a parking system that uses an LCD and a servo motor to manage parking slots. It utilizes two infrared sensors to detect vehicle entry and exit, updating the number of available slots accordingly. The system displays messages on the LCD to inform users about the parking status and controls the gate's position based on sensor inputs.

Uploaded by

aadityabandi5115
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

Parking intimator for Arduino without parking irs

#include <Wire.h>

#include <LiquidCrystal_I2C.h>

#include <Servo.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

Servo myservo;

int IR1 = 2; // Entry sensor

int IR2 = 3; // Exit sensor

int Slot = 4; // Total number of parking slots

int flag1 = 0;

int flag2 = 0;

void setup() {

Serial.begin(9600);

lcd.init(); // Initialize LCD

lcd.backlight(); // Turn on backlight

pinMode(IR1, INPUT);

pinMode(IR2, INPUT);

myservo.attach(10); // ✅ Correct placement: Servo connected to pin 10

myservo.write(100); // Initial gate position (closed)

lcd.setCursor(0, 0);
lcd.print(" ARDUINO ");

lcd.setCursor(0, 1);

lcd.print(" PARKING SYSTEM ");

delay(2000);

lcd.clear();

void loop() {

if (digitalRead(IR1) == LOW && flag1 == 0) {

if (Slot > 0) {

flag1 = 1;

if (flag2 == 0) {

myservo.write(0); // Open gate

Slot = Slot - 1;

} else {

lcd.setCursor(0, 0);

lcd.print(" SORRY :( ");

lcd.setCursor(0, 1);

lcd.print(" Parking Full ");

delay(3000);

lcd.clear();

if (digitalRead(IR2) == LOW && flag2 == 0) {

flag2 = 1;

if (flag1 == 0) {

myservo.write(0); // Open gate

Slot = Slot + 1;

}
}

if (flag1 == 1 && flag2 == 1) {

delay(1000);

myservo.write(100); // Close gate

flag1 = 0;

flag2 = 0;

lcd.setCursor(0, 0);

lcd.print(" WELCOME! ");

lcd.setCursor(0, 1);

lcd.print("Slot Left: ");

lcd.print(Slot);

You might also like