PaulS, here is a mock up of the code I am working on. I have figured out how to use either a relay bank or a multimoto on an Arduino Mega to move my actuators to present positions.
Will an if/else sequence such as posted continue to loop and check for switch changes, or will it get stuck in a portion of the if/else conditions? From what I understand of your previous answers, it will not get stuck.
Each switch is a latching style, not momentary. I also plan to establish the present positions as constants so that they are easier to update/change if required.
//This code is to move 4 linear actuators based on 6 input positions. Positions are 1-6, from left to right, with the middle default position being position 7.
//Each actuator has a potentiometer.
// Each position has a threshold of 25-50
// Actuator 1 default position is 520
// Actuator 2 default position is 520
// Actuator 3 default position is 450
// Actuator 4 default position is 450
// Switch 1 HIGH action - Actuator 1 setting is 450, Actuator 2 is 450, Actuator 3 is 450, Actuator 4 is default
// Switch 2 HIGH action - Actuator 1 setting is 475, Actuator 2 is 475, Actuator 3 is 475, Actuator 4 is default
// Switch 3 HIGH action - Actuator 1 setting is 500, Actuator 2 is 500, Actuator 3 is 500, Actuator 4 is default
// Switch 4 HIGH action - Actuator 1 setting is 540, Actuator 2 is 540, Actuator 3 is default, Actuator 4 is 500
// Switch 5 HIGH action - Actuator 1 setting is 565, Actuator 2 is 565, Actuator 3 is default, Actuator 4 is 475
// Switch 6 HIGH action - Actuator 1 setting is 590, Actuator 2 is 590, Actuator 3 is default, Actuator 4 is 450
// All switches off - default position all actuators
// All switches on - default position all actuators
// Check voltage on Switch 1
// If it is HIGH, then Check Voltage on Switch 6
// Else If Switch 1 is HIGH and 6 is HIGH, then move all actuators to default position
// Else If Switch 1 is HIGH and 6 is LOW then Check Voltage on Switch 5
// Else if Switch 5 is HIGH, Then move Actuator 1 to 500, Actuator 2 to 500, Actuator 3 to default, Actuator 4 to 475
// Else Switch 5 is LOW, Then check Voltage on Switch 4
// Else if Switch 4 is HIGH, then move Actuator 1 to 475, Actuator 2 to 475, Actuator 3 to default, Actuator 4 to 500
// Else if Switch 4 is LOW, the move Actuator 1 to 450, Actuator 2 to 450, Actuator 3 to default, Actuator 4 to 500
// Else if Switch 1 is LOW, then Check Voltage on Switch 2
// Else if Switch 2 is HIGH, Check Voltage on Switch 6
// Else if Switch 6 is HIGH, then move Actuator 1 to 540, Actuator 2 to 540, Actuator 3 to 475, Actuator 4 to default
// Else Switch 6 is LOW, then Check Voltage on Switch 5
// Else if Switch 5 is HIGH, then move Actuator 1 to default, Actuator 2 to default, Actuator 3 to 475, Actuator 4 to 475
// Else Switch 5 is LOW, then Check Voltage on Switch 4
// Else if Switch 4 is HIGH, then move Actuator 1 to 475, Actuator 2 to 475, Actuator 3 to 475, Actuator 4 to 500
// Else Switch 4 is LOW, then move Actuator 1 to 450, Actuator to 450, Actuator 3 to 475, Actuator 4 to 500
// Else Switch 2 is LOW(Switch 1 is also LOW), Check Voltage on Switch 3
// Else if Switch 3 is HIGH, Check Voltage on Switch 6
// Else if Switch 6 is HIGH, move Actuator 1 to 565, Actuator 2 to 565, Actuator 3 to 500, Actuator 4 to default
// Else Switch 6 is LOW, Check Voltage on Switch 5
// Else if Switch 5 is HIGH, move Actuator 1 to 565, Actuator 2 to 565, Actuator 3 to 500, Actuator 4 to 475
// Else Switch 5 is LOW, Check Voltage on Switch 4
// Else if Switch 4 is HIGH, move Actuator 1 to default, Actuator 2 to default, Actuator 3 to 500, Actuator 4 to 500
// Else Switch 4 is LOW, move Actuator 1 to 450, Actuator 2 to 450 Actuator 3 to 500, Actuator 4 to 500
// Else Switch 3 is LOW (Switches 1 and 2 are LOW), Check Voltage on Switch 6
// Else if Switch 6 is HIGH, move Actuator 1 to 590, Actuator 2 to 590, Actuator 3 to 500, Actuator 4 to default
// Else Switch 6 is LOW, Check Voltage on Switch 5
// Else if Switch 5 is HIGH, move Actutator 1 to 590, Actuator 2 to 590, Actuator 3 to 500, Actuator 4 to 475
// Else Switch 5 is LOW, Check Voltage on Switch 4
// Else if Switch 4 is HIGH, move Actuator 1 to 590, Actuator 2 to 590, Actuator 3 to 500, Actuator 4 to 500
// Else Switch 4 is LOW, Move Actuator 1 to default, Actuator 2 to default, Actuator 3 to default, Actuator 4 to default
// end loop