//YWROBOT
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
void setup()
{
pinMode (4,INPUT_PULLUP);
pinMode(5, OUTPUT);
lcd.init(); // initialize the lcd
lcd.init();
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Car Park");
lcd.setCursor(0,1);
lcd.print("PTSS");
delay(1000);
lcd.clear();
}
int a=5;
void loop()
{
//Read button State
int buttonState = digitalRead(4);
//Check button State
if(buttonState == LOW){
//if press then a = a - 1
if (a > 0){
a = a - 1;
//Display LCD
lcd.clear();
lcd.setCursor(7,0);
lcd.print(a);
delay(500);
}
}
if (a == 0){
lcd.setCursor(6,1);
lcd.print("FULL");
blink();
}
}
void blink(void){
digitalWrite(5, HIGH);
delay(300);
digitalWrite(5, LOW);
delay(300);
}