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?
© Espruino, powered by microcosm.
Report a problem