r/ArduinoHelp • u/Embarrassed-Lab6622 • Jul 07 '26
Coding for resistor ladder input on ESP32
Hello. I am trying to write some code in Arduino that will read the input pin (D32) and based on the on the different voltage, the will different outputs and a timer. Is it as simple as:
if (SWITCH_INPUT == >3.0 && !timerActive) {
digitalWrite(HIGH_HEAT, HIGH); // Turn the seat heater on HIGH
previousMillis = millis(); // Save the starting timestamp of the timer
timerActive = true; // Flag that the timer is now active
}
Then repeat for each of the 6 positions of the input switch?
1
Upvotes
View all comments
Show parent comment
1
u/Embarrassed-Lab6622 Jul 08 '26
Thanks again for the comments.
The ==> was a mistake that has since been corrected and your previous comments about the values were noted,
I just left the numbers in there as place holders until I can test the switch to get real values.
So you are suggesting that I should be looking at buttonState not SWITCH_INPUT. Noted.
And that I need to redefine SWITCH_INPUT. Noted.
I will do some more reading and testing with sample codes.
I appreciate your time and knowledge.