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 07 '26
thanks for the response! It has been a minute since I coded and it is SLOWLY coming back to me. Yes, I am trying to generate 6 different possibilities baased on different voltage levels. This is to hack the GM LIN seat controllers for use in my 58 Truck. 3 heat outputs and 3 cool outputs (fan in the seat). If the heater is on for more than 25 minutes, it will automatically drop it to the next lower setting, or off in the lowest setting. Fan output is just serial write to a digital frequency generator to control the fan. Code so far....