const int pbOn1=2;
const int pbOn2=3;
const int pbOff=4;
const int tor=5;
const int mainContactor=6;
const int yContactor=7;
const int deltaContactor=8;
const int source=9;
const int fault=10;
int R1;


void setup() {
  // put your setup code here, to run once:
pinMode(pbOn1, INPUT);
pinMode(pbOn2, INPUT);
pinMode(pbOff, INPUT);
pinMode(tor, INPUT);
pinMode(mainContactor, OUTPUT);
pinMode(yContactor, OUTPUT);
pinMode(deltaContactor, OUTPUT);
pinMode(source, OUTPUT);
pinMode(fault, OUTPUT);
R1 = digitalRead(mainContactor);
}

void loop() {
  // put your main code here, to run repeatedly:
  if ((digitalRead(pbOn1)==1 || (R1)==1) && digitalRead(pbOff)==0)
  {digitalWrite(mainContactor,1);
    R1=digitalRead(mainContactor);}
  else
      {digitalWrite(mainContactor,0);
     R1=digitalRead(mainContactor);}
  if((R1)==1)
  menu1();
}
void menu1(){
if (digitalRead(tor)==HIGH)
digitalWrite(yContactor, HIGH);
else
digitalWrite(yContactor, LOW);
}