Three Phase Load balancing

const int RO1=8;
const int RO2=9;
const int YO1=10;
const int YO2=11;
const int BO1=12;
const int BO2=13;

const int RI1=2;
const int RI2=3;
const int YI1=4;
const int YI2=5;
const int BI1=6;
const int BI2=7;
void setup(){
pinMode(RO1,OUTPUT);
pinMode(RO2,OUTPUT);
pinMode(YO1,OUTPUT);
pinMode(YO2,OUTPUT);
pinMode(BO1,OUTPUT);
pinMode(BO2,OUTPUT);
Serial.begin(9600);

pinMode(RI1,INPUT);
pinMode(RI2,INPUT);
pinMode(YI1,INPUT);
pinMode(YI2,INPUT);
pinMode(BI1,INPUT);
pinMode(BI2,INPUT);
}
void loop()
{
if((digitalRead(RI1)==HIGH)&&(digitalRead(RI2)==LOW)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==HIGH))
{
digitalWrite(RO2,LOW);
digitalWrite(RO1,HIGH);
digitalWrite(YO2,LOW);
digitalWrite(YO1,HIGH);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,HIGH);
delay(2000);
}

  if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==LOW)&&(digitalRead(BI2)==HIGH))

{
digitalWrite(RO1,LOW);
digitalWrite(RO2,HIGH);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,HIGH);
digitalWrite(BO1,LOW);
digitalWrite(BO2,HIGH);
delay(2000);
}

  if((digitalRead(RI1)==HIGH)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==LOW))

{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,HIGH);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,HIGH);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,LOW);
delay(2000);
}
////////
if((digitalRead(RI1)==HIGH)&&(digitalRead(RI2)==LOW)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,LOW);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,LOW);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,LOW);
delay(2000);
}
if((digitalRead(RI1)==HIGH)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,HIGH);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,LOW);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,LOW);
delay(2000);
}
////101111

////
if((digitalRead(RI1)==HIGH)&&(digitalRead(RI2)==LOW)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==LOW)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,LOW);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,LOW);
digitalWrite(BO1,LOW);
digitalWrite(BO2,LOW);
delay(2000);
}
///
//010111
if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==LOW)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==HIGH))
{
digitalWrite(RO1,LOW);
digitalWrite(RO2,HIGH);
digitalWrite(YO1,LOW);
digitalWrite(YO2,HIGH);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,HIGH);
delay(2000);
}

//

if((digitalRead(RI1)==HIGH)&&(digitalRead(RI2)==LOW)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,LOW);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,LOW);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,LOW);
delay(2000);
}
////001111
if((digitalRead(RI1)==HIGH)&&(digitalRead(RI2)==LOW)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==HIGH))
{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,LOW);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,LOW);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,HIGH);
delay(2000);
}
////110011
if((digitalRead(RI1)==HIGH)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==LOW)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==HIGH))
{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,HIGH);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,LOW);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,LOW);
delay(2000);
}
//100000
if((digitalRead(RI1)==HIGH)&&(digitalRead(RI2)==LOW)&&(digitalRead(YI1)==LOW)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==LOW)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,LOW);
digitalWrite(YO2,LOW);
digitalWrite(YO1,LOW);
digitalWrite(BO2,LOW);
digitalWrite(BO1,LOW);
delay(2000);
}
if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==LOW)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==LOW)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO2,HIGH);
digitalWrite(RO1,LOW);
digitalWrite(YO2,LOW);
digitalWrite(YO1,LOW);
digitalWrite(BO2,LOW);
digitalWrite(BO1,LOW);
delay(2000);
}
if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==LOW)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==LOW)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO1,LOW);
digitalWrite(RO2,LOW);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,LOW);
digitalWrite(BO2,LOW);
digitalWrite(BO1,LOW);
delay(2000);
}
if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==LOW)&&(digitalRead(YI1)==LOW)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==LOW)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO1,LOW);
digitalWrite(RO2,LOW);
digitalWrite(YO1,LOW);
digitalWrite(YO2,HIGH);
digitalWrite(BO2,LOW);
digitalWrite(BO1,LOW);
delay(2000);
}
if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==LOW)&&(digitalRead(YI1)==LOW)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO1,LOW);
digitalWrite(RO2,LOW);
digitalWrite(YO2,LOW);
digitalWrite(YO1,LOW);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,LOW);
delay(2000);
}
if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==LOW)&&(digitalRead(YI1)==LOW)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==LOW)&&(digitalRead(BI2)==HIGH))
{
digitalWrite(RO1,LOW);
digitalWrite(RO2,LOW);
digitalWrite(YO2,LOW);
digitalWrite(YO1,LOW);
digitalWrite(BO1,LOW);
digitalWrite(BO2,HIGH);
delay(2000);
}
////
if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==LOW)&&(digitalRead(YI1)==LOW)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==LOW)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO1,LOW);
digitalWrite(RO2,LOW);
digitalWrite(YO2,LOW);
digitalWrite(YO1,LOW);
digitalWrite(BO2,LOW);
digitalWrite(BO1,LOW);
delay(2000);
}
////
if((digitalRead(RI1)==HIGH)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==LOW)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==LOW)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,LOW);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,LOW);
digitalWrite(BO2,LOW);
digitalWrite(BO1,LOW);
delay(2000);
}
if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==LOW)&&(digitalRead(BI2)==HIGH))
{
digitalWrite(RO1,LOW);
digitalWrite(RO2,HIGH);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,HIGH);
digitalWrite(BO1,LOW);
digitalWrite(BO2,HIGH);
delay(2000);
}
/////////

if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==LOW)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==LOW)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,LOW);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,LOW);
digitalWrite(BO2,LOW);
digitalWrite(BO1,LOW);
delay(2000);
}

////
if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==LOW)&&(digitalRead(YI1)==LOW)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==HIGH))
{
digitalWrite(RO1,LOW);
digitalWrite(RO2,LOW);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,LOW);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,LOW);
delay(2000);
}
if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==LOW)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==LOW)&&(digitalRead(BI2)==HIGH))
{
digitalWrite(RO1,LOW);
digitalWrite(RO2,HIGH);
digitalWrite(YO1,LOW);
digitalWrite(YO2,HIGH);
digitalWrite(BO1,LOW);
digitalWrite(BO2,HIGH);
delay(2000);
}
if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==LOW)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==LOW)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO1,LOW);
digitalWrite(RO2,HIGH);
digitalWrite(YO1,LOW);
digitalWrite(YO2,HIGH);
digitalWrite(BO2,LOW);
digitalWrite(BO1,LOW);
delay(2000);
}
if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==LOW)&&(digitalRead(YI1)==LOW)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==LOW)&&(digitalRead(BI2)==HIGH))
{
digitalWrite(RO1,LOW);
digitalWrite(RO2,LOW);
digitalWrite(YO1,LOW);
digitalWrite(YO2,HIGH);
digitalWrite(BO1,LOW);
digitalWrite(BO2,HIGH);
delay(2000);
}
if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==LOW)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO1,LOW);
digitalWrite(RO2,LOW);
digitalWrite(YO2,LOW);
digitalWrite(YO1,HIGH);
digitalWrite(BO2,LOW);
digitalWrite(BO1,HIGH);
delay(2000);
}
//010001
if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==LOW)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==LOW)&&(digitalRead(BI2)==HIGH))
{
digitalWrite(RO1,LOW);
digitalWrite(RO2,HIGH);
digitalWrite(YO1,LOW);
digitalWrite(YO2,LOW);
digitalWrite(BO1,LOW);
digitalWrite(BO2,HIGH);
delay(2000);
}
//000101
if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==LOW)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==LOW)&&(digitalRead(BI2)==HIGH))
{
digitalWrite(RO1,LOW);
digitalWrite(RO2,LOW);
digitalWrite(YO1,LOW);
digitalWrite(YO2,HIGH);
digitalWrite(BO1,LOW);
digitalWrite(BO2,HIGH);
delay(2000);
}
// 011110
if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO1,LOW);
digitalWrite(RO2,HIGH);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,HIGH);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,LOW);
delay(2000);
}
// 111110
if((digitalRead(RI1)==HIGH)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,HIGH);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,HIGH);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,LOW);
// delay(2000);
}
if((digitalRead(RI1)==HIGH)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==LOW)&&(digitalRead(BI2)==HIGH))
{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,HIGH);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,HIGH);
digitalWrite(BO1,LOW);
digitalWrite(BO2,HIGH);
// delay(2000);
}
if((digitalRead(RI1)==HIGH)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==LOW)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==HIGH))
{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,HIGH);
digitalWrite(YO1,LOW);
digitalWrite(YO2,HIGH);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,HIGH);
delay(2000);
}
if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==HIGH))
{
digitalWrite(RO1,LOW);
digitalWrite(RO2,HIGH);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,HIGH);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,HIGH);
delay(2000);
}
if((digitalRead(RI1)==HIGH)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==HIGH))
{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,HIGH);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,HIGH);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,HIGH);
// delay(2000);
}
if((digitalRead(RI1)==HIGH)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==HIGH))
{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,HIGH);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,LOW);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,HIGH);
delay(2000);
}
if((digitalRead(RI1)==HIGH)&&(digitalRead(RI2)==LOW)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==HIGH))
{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,LOW);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,HIGH);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,HIGH);

}
if((digitalRead(RI1)==HIGH)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==LOW)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,HIGH);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,LOW);
digitalWrite(BO1,LOW);
digitalWrite(BO2,LOW);
delay(2000);
}
if((digitalRead(RI1)==HIGH)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==LOW)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,HIGH);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,LOW);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,LOW);
delay(2000);
}
if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==LOW)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==HIGH))
{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,LOW);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,HIGH);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,LOW);
delay(2000);
}
if((digitalRead(RI1)==HIGH)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==LOW)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==LOW)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO1,LOW);
digitalWrite(RO2,HIGH);
digitalWrite(YO2,HIGH);
digitalWrite(YO1,LOW);
digitalWrite(BO2,HIGH);
digitalWrite(BO1,LOW);
delay(2000);
}
if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==LOW)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==HIGH))
{
digitalWrite(RO1,LOW);
digitalWrite(RO2,HIGH);
digitalWrite(YO2,HIGH);
digitalWrite(YO1,LOW);
digitalWrite(BO2,HIGH);
digitalWrite(BO1,LOW);
delay(2000);
}
if((digitalRead(RI1)==HIGH)&&(digitalRead(RI2)==HIGH)&&(digitalRead(YI1)==LOW)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,LOW);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,LOW);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,LOW);
delay(2000);
}
if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==LOW)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==HIGH)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==LOW))
{
digitalWrite(RO1,HIGH);
digitalWrite(RO2,LOW);
digitalWrite(YO1,HIGH);
digitalWrite(YO2,LOW);
digitalWrite(BO1,HIGH);
digitalWrite(BO2,LOW);
delay(2000);
}
/**

if((digitalRead(RI1)==LOW)&&(digitalRead(RI2)==LOW)&&(digitalRead(YI1)==HIGH)&&(digitalRead(YI2)==LOW)&&(digitalRead(BI1)==HIGH)&&(digitalRead(BI2)==LOW))

{
digitalWrite(RO1,LOW);
digitalWrite(RO2,LOW);
digitalWrite(YO1,LOW);
digitalWrite(YO2,HIGH);
digitalWrite(BO1,LOW);
digitalWrite(BO2,HIGH);
delay(2000);
} / / else
{

digitalWrite(RO1,HIGH);
digitalWrite(RO2,HIGH);
digitalWrite(YO2,HIGH);
digitalWrite(YO1,HIGH);
 digitalWrite(BO2,HIGH);
digitalWrite(BO1,HIGH);
 //delay(20000);

}*/
}

Leave a Reply

Your email address will not be published. Required fields are marked *