dikcys
Published

Smart Gate for Smart Parking

This project is about automatic doorstop and vehicle counters.

BeginnerProtip5,315
Smart Gate for Smart Parking

Things used in this project

Hardware components

Photodiode, 20 °
Photodiode, 20 °
×2
Laser Diode, Visible
Laser Diode, Visible
×2
SG90 Micro-servo motor
SG90 Micro-servo motor
×2
Grove - 16 x 2 LCD (White on Blue)
Seeed Studio Grove - 16 x 2 LCD (White on Blue)
×1
Arduino UNO
Arduino UNO
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Through Hole Resistor, 30 kohm
Through Hole Resistor, 30 kohm
×1
Custom PCB
Custom PCB
×1

Software apps and online services

Arduino IDE
Arduino IDE
Windows 10
Microsoft Windows 10

Story

Read more

Schematics

SCHEMATICS

SCHEMATICS

Code

Smart gate for smart parking

Arduino
#include <Servo.h>
#include <LiquidCrystal.h>
int hasil,jumlah1,total,nilai,jumlah2;
const int rs = 7, en = 8, d4 =12, d5=11, d6=10, d7=9;  
LiquidCrystal lcd (rs,en,d4,d5,d6,d7);  
Servo myservo;    //Inisialisasi servo 1
Servo myservo2;   //Inisialisasi servo 2

void setup() {
myservo.attach(13);   //Pin mode arduino servo 1
myservo2.attach(6);   //Pin mode arduino servo 2
Serial.begin(9600);  
pinMode(5, INPUT_PULLUP);   //Pin 5 arduino sebaai input pada kondisi pull up
pinMode(A0,INPUT);    
lcd.begin (16,2); 
lcd.print("MIKROKONTROLER 2 ! ");
delay(1000);  
lcd.clear();  
lcd.setCursor(4,0);   
lcd.print("Total=");  
lcd.setCursor(0,1);   
lcd.print("IN=");   
lcd.setCursor(8,1);  
lcd.print("OUT=");  
}
void loop() {
  hasil=analogRead(A0);   
  Serial.println(hasil);    

  if (hasil > 700)    
  {
    myservo.write(90);  
    jumlah1++;    1
    total++;  
    lcd.setCursor(4,1);   
    lcd.print(jumlah1);   
    lcd.setCursor(11,0);  
    lcd.print(total);  
    
    delay(7000);   
    }
    else {    
      myservo.write(0); 
      }
if (digitalRead(5)==LOW)   
  {while(digitalRead(5)==LOW){}   
    total--;    
    jumlah2++;    
    lcd.setCursor(13,1);    
    lcd.print(jumlah2);  
    lcd.setCursor(11,0);    
    lcd.print(total);   
    myservo2.write(90);   
    delay(7000);    
    myservo2.write(0);   
}
else { myservo2.write(0);}
    }

Credits

dikcys
1 project • 1 follower
Contact

Comments

Please log in or sign up to comment.