0% found this document useful (0 votes)
7 views2 pages

Car Parking System.ino

Uploaded by

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

Car Parking System.ino

Uploaded by

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

#include <LiquidCrystal.

h>// initialize the library with the numbers of the


interface pins
LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);
#include <Servo.h> //includes the servo library

Servo myservo1;

int ir_s1 = 2;
int ir_s2 = 4;

int Total = 5;
int Space;

int flag1 = 0;
int flag2 = 0;

void setup() {
pinMode(ir_s1, INPUT);
pinMode(ir_s2, INPUT);

myservo1.attach(3);
myservo1.write(100);

lcd.begin(16, 2);
lcd.setCursor (0,0);
lcd.print(" Car Parking ");
lcd.setCursor (0,1);
lcd.print(" System ");
delay (2000);
lcd.clear();

Space = Total;
}

void loop(){

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


if(Space>0){flag1=1;
if(flag2==0){myservo1.write(0); Space = Space-1;}
}else{
lcd.setCursor (0,0);
lcd.print(" Sorry not Space ");
lcd.setCursor (0,1);
lcd.print(" Available ");
delay (1000);
lcd.clear();
}
}

if(digitalRead (ir_s2) == LOW && flag2==0){flag2=1;


if(flag1==0){myservo1.write(0); Space = Space+1;}
}

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


delay (1000);
myservo1.write(100);
flag1=0, flag2=0;
}
lcd.setCursor (0,0);
lcd.print("Total Space: ");
lcd.print(Total);

lcd.setCursor (0,1);
lcd.print("Have Space: ");
lcd.print(Space);
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy