Else Statement Causing a Drop in Output Voltage

Hello,
I am having issues with my digitalOutput functions on my Arduino Uno. The code is meant to analogRead 3 inputs and then digitalOutput based on those. I have used 3 if statements to do this and wanted to add an else statement (commented out in code below) to put all 3 digitalOutputs to LOW if no inputs are detected. However, once I add in the else statement, the digitalOutput will only output 1.7 V. The outputs are all fine without the else statement but I don't see how adding in this else statement should change the outputs. Any advice? Thanks in advance.

Linear_Test_Small.ino (1.36 KB)

your else statement is put in effect when your last if statement is false. the reason your seeing 1.7v is because when one of the first if statements is true the pin goes HIGH but then the last if is false so the else turns it back LOW this happens every time thru loop so it turns on and off very quickly and your voltmeter cant react that fast so it is reading an avg.

Try using

if() {
}
else if() {
}
else if() {
}
else {
}

That way the else is only executed when ALL 3 if statements are false

@Hutkikz that worked perfectly. Thank you!