#include <LiquidCrystal.h>
int packs = 0;
int box = 0;
int loads = 0;
int count = 0;
int switchPin = 6;
int switchState = LOW;
int lastSwitchState = HIGH;
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);
}
void loop()
{
switchState = digitalRead(switchPin);
if (switchState == LOW && lastSwitchState == HIGH);
{
count++;
Serial.print("Bottle Count: ");
Serial.println(count);
lcd.print("Bottle count: ");
lcd.setCursor(0, 1);
lcd.print(count);
delay(50);
lcd.clear();
}
if (count % 6 == 0)
{
packs++;
Serial.print("Packages: ");
Serial.println(packs);
lcd.setCursor(0, 1);
lcd.print(packs);
delay(50);
lcd.clear();
}
if(packs % 10 == 0)
{
packs++;
Serial.print("Box: ");
Serial.print(box);
lcd.setCursor(0, 1);
lcd.print(box);
delay(50);
lcd.clear();
}
lastSwitchState = switchState;
}