int a = A0;
int b = A1;
int c = A2;
int MOSFET1 = 3; //MOSFET1 connected to pin
int MOSFET2 = 5; //MOSFET2 connected to pin
int MOSFET3 = 6; //MOSFET3 connected to pin
int MOSFET4 = 9; //MOSFET4 connected to pin
int MOSFET5 = 10; //MOSFET5 connected to pin
int MOSFET6 = 11; //MOSFET6 connected to pin
void setup() {
// put your setup code here, to run once:
pinMode(a, INPUT);
pinMode(b, INPUT);
pinMode(c, INPUT);
pinMode(MOSFET1, OUTPUT); //sets digital pin as output
pinMode(MOSFET2, OUTPUT); //sets digital pin as output
pinMode(MOSFET3, OUTPUT); //sets digital pin as output
pinMode(MOSFET4, OUTPUT); //sets digital pin as output
pinMode(MOSFET5, OUTPUT); //sets digital pin as output
pinMode(MOSFET6, OUTPUT); //sets digital pin as output
}
void loop() {
// put your main code here, to run repeatedly:
A_H = digitalRead(a, HIGH);
B_H = digitalRead(b, HIGH);
C_H = digitalRead(b, HIGH);
A_L = digitalRead(a, LOW);
B_L = digitalRead(b, LOW);
C_L = digitalRead(b, LOW);
calc = a – b;
calc2 = a – c;
calc3 = b – c;
if calc > 0
if calc2 > 0
digitalWrite(MOSFET1, HIGH);
if calc3 > 0
digitalWrite(MOSFET2, HIGH);
elseif calc3 < 0
digitalWrite(MOSFET6, HIGH);
end
elseif calc2 < 0
digitalWrite(MOSFET5, HIGH);
digitalWrite(MOSFET6, HIGH);
end
elseif calc < 0
if calc2 > 0
digitalWrite(MOSFET3, HIGH);
digitalWrite(MOSFET2, HIGH);
elseif calc2 < 0
digitalWrite(MOSFET4, HIGH);
if calc3 > 0
digitalWrite(MOSFET3, HIGH);
elseif calc3 < 0
digitalWrite(MOSFET5, HIGH);
end
end
end
}