I assume that you have a hum or open wire somewhere that makes your comparator act like a multi vibrator around the switching point.
You would need something like a Schmitt trigger with - configurable - hysteresis. You even may use your comparator with some added components to avoid the 'vibrating' - see https://daycounter.com/Calculators/Comparator-Hystereses-Calculator.phtml
Could you show the setup of the circuitry in a uploaded picture?
@allObjects started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I assume that you have a hum or open wire somewhere that makes your comparator act like a multi vibrator around the switching point.
You would need something like a Schmitt trigger with - configurable - hysteresis. You even may use your comparator with some added components to avoid the 'vibrating' - see https://daycounter.com/Calculators/Comparator-Hystereses-Calculator.phtml
Could you show the setup of the circuitry in a uploaded picture?