#include <LiquidCrystal.h>
int packs = 0;
int box = 0;
int loads = 0;
int count = 0;
int switchPin = 6;
int switchState = HIGH;
int lastSwitchState = HIGH;
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);
}
void loop()
{
switchState = digitalRead(switchPin);
if (switchState == LOW && lastSwitchState == HIGH);
{
count++;
Serial.print("Bottle Num: ");
Serial.println(count);
lcd.print("Bottle Num: ");
lcd.setCursor(0, 1);
lcd.print(count);
delay(1);
lcd.clear();
}
if (count % 6 == 0)
{
packs++;
Serial.print("PACKAGES: ");
Serial.println(packs);
lcd.setCursor(0, 1);
lcd.print(packs);
delay(1000);
lcd.clear();
}
if (count % 60 == 0)
{
box++;
Serial.print("BOX: ");
Serial.println(box);
lcd.setCursor(0, 1);
lcd.print(box);
delay(1000);
lcd.clear();
}
if(count % 300 == 0)
{
loads++;
Serial.print("LOADS: ");
Serial.println(loads);
lcd.print("LOADS: ");
lcd.setCursor(0, 1);
lcd.print(loads);
delay(500);
lcd.clear();
}
lastSwitchState = switchState;
}