You are on page 1of 2

int blinkLED = 13;

int tank1LED = 11;


int tank2LED = 12;

const int longCycleLength = 2*110; //pressurize


cycle length 110 seconds
const int shortCycleLength = 01; //overlap length
const int startNewCycle = longCycleLength - shortCycleLength; //only one tank
flowing
const int blankingPeriod = longCycleLength - (2*shortCycleLength); //time tank is
venting

int count1 = 0; //counters for cycles


int count2 = startNewCycle;

boolean tank1Filling = true; //status if tank pressurizing


boolean tank2Filling = true;

void setup()
{
pinMode(tank1LED, OUTPUT);
pinMode(tank2LED, OUTPUT);
pinMode(blinkLED, OUTPUT);
digitalWrite(tank1LED,HIGH);
digitalWrite(tank2LED,HIGH);

void loop()
{

digitalWrite(blinkLED,HIGH);
delay(250);
digitalWrite(blinkLED,LOW);
delay(250); //total of 1/2 second delay
//1/2 sec * 2 * 110 = 110 second cycle
count1++;
count2++;
if ((tank1Filling) && (count1 == longCycleLength))
{
// full cycle complete toggle 1st tank status
tank1Filling = false;
count1 = 0;
digitalWrite(tank1LED,LOW);
}
else if ((!tank1Filling) && (count1 == blankingPeriod))
{
tank1Filling = true;
count1 = 0;
digitalWrite(tank1LED,HIGH);
}

if ((tank2Filling) && (count2 == longCycleLength))


{
// full cycle complete toggle 1st tank status
tank2Filling = false;
count2 = 0;
digitalWrite(tank2LED,LOW);
}
else if ((!tank2Filling) && (count2 == blankingPeriod))
{
tank2Filling = true;
count2 = 0;
digitalWrite(tank2LED,HIGH);
}

You might also like