//**************************************************************************
int Sieve_A_Valve = 3; //small distributor
int Sieve_B_Valve = 4;
int Sieve_B_Valve2 = 5;//Defined Pin as Variable
int PreCharge_Valve = 6; //Defined Pin as Variable
// VARIABLE CREATION
//**************************************************************************
unsigned long Relay_Test_Delay; //delay variable creation
unsigned long Startup_Purge_Delay; //delay variable creation
unsigned long Production_Delay; //delay variable creation
unsigned long Flush_Delay; //delay variable creation
unsigned long PreCharge_Delay; //delay variable creation
//**************************************************************************
void setup()
{
// STARTUP
//**************************************************************************
// Serial Port initialization
Serial.begin(9600);
// SET PIN MODE FOR PINS IN PROGRAM
//**************************************************************************
pinMode(Sieve_A_Valve, OUTPUT);
pinMode(Sieve_B_Valve, OUTPUT);
pinMode(Sieve_B_Valve2, OUTPUT);
pinMode(PreCharge_Valve, OUTPUT);
// SET DELAY TIMING HERE
//**************************************************************************
Relay_Test_Delay = 0;
Startup_Purge_Delay = 3000;
Production_Delay = 6000;
Flush_Delay = 450;
PreCharge_Delay = 650;
}
void loop()
{
//CYCLE 1
//**************************************************************************
Serial.println("Sieve A Charge / Sieve B Purge");
digitalWrite(Sieve_A_Valve, HIGH);
digitalWrite(Sieve_B_Valve, LOW);
digitalWrite(Sieve_B_Valve2, HIGH);
digitalWrite(PreCharge_Valve, HIGH); //changed
delay(Production_Delay);
//CYCLE 2
//**************************************************************************
Serial.println("Sieve A Charge / Sieve B Purge / Flush/PreCharge");
digitalWrite(Sieve_A_Valve, HIGH);
digitalWrite(Sieve_B_Valve, LOW);
digitalWrite(Sieve_B_Valve2, HIGH);
digitalWrite(PreCharge_Valve, LOW); //changed
delay(Flush_Delay) ;
//CYCLE 3
//**************************************************************************
Serial.println("Sieve A Charge / Sieve B Charge / Flush/PreCharge");
digitalWrite(Sieve_A_Valve, HIGH);
digitalWrite(Sieve_B_Valve, HIGH);
digitalWrite(Sieve_B_Valve2, LOW);
digitalWrite(PreCharge_Valve, LOW); //changed
delay(PreCharge_Delay);
//CYCLE 4
//**************************************************************************
Serial.println("Sieve A Purge / Sieve B Charge");
digitalWrite(Sieve_A_Valve, LOW);
digitalWrite(Sieve_B_Valve, HIGH);
digitalWrite(Sieve_B_Valve2, LOW);
digitalWrite(PreCharge_Valve, HIGH); //changed
delay(Production_Delay);
//CYCLE 5
//**************************************************************************
Serial.println("Sieve A Purge / Sieve B Charge / Flush/PreCharge");
digitalWrite(Sieve_A_Valve, LOW);
digitalWrite(Sieve_B_Valve, HIGH);
digitalWrite(Sieve_B_Valve2, LOW);
digitalWrite(PreCharge_Valve, LOW); //changed
delay(Flush_Delay);
//CYCLE 6
//**************************************************************************
Serial.println("Sieve A Charge / Sieve B Charge / Flush/PreCharge");
digitalWrite(Sieve_A_Valve, HIGH);
digitalWrite(Sieve_B_Valve, HIGH);
digitalWrite(Sieve_B_Valve2, LOW);
digitalWrite(PreCharge_Valve, LOW); //changed
delay(PreCharge_Delay) ;
}
Alexandre_6 0 Newbie Poster
rproffitt 2,662 "Nothing to see here." Moderator
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.