I have a valve that operates on 24VAC with limit switchs. I want to use this on a MCU as an input, what is the best wat to do that? Can I use a transistor?
One way would be to use a series diode and an optocoupler (plus a current limiting resistor of course). You could add a capacitor across the LED to keep it illuminated during the negative half of the cycle or deal with the pulsating LED in code.