Morgan, Yes I have come to that same conclusion.
Especially in the switching of the modes, I wouldn't want it to start in a false position.
It's home location will always be down, and upon switching into a mode it will default there.
Okay, So. I'm really out of date here and my coding is so rusty I need to go back to basics.
I'm a little ashamed I didn't try to compile this yesterday when I was brainstorming it out since it is so error ridden..
Hopefully, I'll have time to correct it tomorrow, however just posting to get this gist of things.
I definitely do not remember how the If statements are, If, &, OR, Else.. Tutorial time tomorrow.
Anyways I did catch this link in my searches "Need Help Proximity Switch Protection to Hydraulic Cylinder"
int SensorUP = 4;
int SensorDown = 7;
int LedUP = 21;
int LedDown = 9;
int Relay1Up = 5;
int Relay2Down = 6;
int Relay3Up = 14;
int Relay4Down = 15;
int Inch = 10;
int Single = 11;
int Auto = 12;
int Batch = 13;
int Sensors = 8;
int SensorUP = 4;
int InchOn = digitalRead(Inch);
int SingleOn = digitalRead(Single);
int AutoOn = digitalRead(Auto);
int LastPos = 0;
if (InchOn == HIGH) //Check Switch Position
SolVal1 = digitalRead(SensorUp); //(INCH MODE:) Check Cylinder Position
SolVal2 = digitalRead(SensorDown);
digitalWrite (Relay4Down, LOW); // Don't Cross Automatic Relay's
digitalWrite (Relay3Up, LOW); // Don't Cross Automatic Relay's
if (SolVal1 == LOW) //Low = Hall Magnetic Sensor Reading //SolVal1 Pos is UP
int LastPos = 1
digitalWrite (LedUP, HIGH); //LED Indicates Up Position
digitalWrite (Relay1Up, LOW); //Power Off
digitalWrite (Relay2Down, HIGH); //Send Cylinder to Cycle Down Next
digitalWrite (LedDown, LOW); //LED Down Light Off
if (SolVal2 == LOW) //Hall Magnetic Sensor Indicates Position Is DOWN
int LastPos = 2
digitalWrite (LedDown, HIGH); //LED Indicates Down Position
digitalWrite (Relay1Up, HIGH); //Send Cylinder to Cycle Up Next
digitalWrite (Relay1Down, LOW);
digitalWrite (LedUP, LOW);
else //Neutral Position, However don't want to auto loop and retract prior to full up cycle
if LastPos = 1;
//To Stop Mis Cycle or Repeat
if LastPos = 2;
//to Stop Mis-Cycle or Repeat
if LastPos = 0;
digitalWrite (Relay1Up, LOW)
digitalWrite (Relay2Down, HIGH)
They call it a rough draft right?