#include <LiquidCrystal_I2C.h>
#define SW1 13   //float sensor
#define PB1 10   //to system ready 
#define PB2  9   //to open SolFill
#define PB3  8   //to pause the process

#define SolFill 7
#define SolDrain 6
#define Pump 5
#define LeftorRight 4 //0 = left, 1 = right
#define MotorRun 3
LiquidCrystal_I2C lcd(0x27, 16, 2);

int ProcessStatus = 0;  //to indicate currenct process
int ProcessStatus_buff = 0;
bool ReadyStatus = 0;   //Status Ready
bool pb1_pressed, pb2_pressed, pb3_pressed;

unsigned long T_nowP2, T_nowP3, T_nowP4, T_nowP5, T_nowP6, T_nowP7, T_nowP8;

unsigned long DurationP2 = 6000;  //durasi proses 2 in ms pump running
unsigned long DurationP3 = 10000;  //durasi proses 3 in ms motor running bergantian
unsigned long DurationP4 = 5000;   //durasi proses 4 in ms SolDrain
unsigned long DurationP5 = 8000;   //durasi proses 5 in ms motor running bergantian
unsigned long DurationP7 = 6000;   //durasi proses 7 in ms motor running bergantian
unsigned long DurationP8 = 5000;   //durasi proses 8 in ms SolDrain

unsigned long DurationP9 = 6000;   //delay off pumpa bergatin in ms
int LCD_refresh_rate = 200;

void setup() {
  Serial.begin(9600);

  pinMode(SW1, INPUT);
  pinMode(PB1, INPUT);
  pinMode(PB2, INPUT);
  pinMode(PB3, INPUT);

  pinMode(SolFill, OUTPUT);
  pinMode(SolDrain, OUTPUT);
  pinMode(Pump, OUTPUT);
  pinMode(LeftorRight, OUTPUT);
  pinMode(MotorRun, OUTPUT);

  //turn on Motor Run and LeftorRight
  digitalWrite(SolFill, HIGH);
  digitalWrite(SolDrain, HIGH);
  digitalWrite(Pump, HIGH);
  digitalWrite(LeftorRight, HIGH);
  digitalWrite(MotorRun, HIGH);

  lcd.init();
  lcd.backlight();
  lcd.clear();
}


void loop()
{
}
}