Using a switch & LED to drive input pin
i have magnetic switches on windows , doors. when window open switch on. want use turn on relay 1 second though switch stay on extended period. can in sketch no problem have panel on wall of floor plan of house , there led there window or door. need these leds stay on while window open. easy way use 2 output pins 1 drive relay drive led. there way connect 5 volts in circuit led , magnetic switch pin turn on relay.
thanks
rick
thanks
rick
quote
is there way connect 5 volts in circuit led , magnetic switch pin turn on relay.sure! wire led in series resistor (as usual). connect 1 end of led/resistor +5v , other end switch. ground other switch contact. now when close switch closed (turned on), led come on.
thanks
also connect non-grounded end of switch arduino input. enable arduino's internal pull-up resistor make sure input reads high when switch open. when switch on (closed) , arduino input pulled low. sketch can read input state , take appropriate action.
Arduino Forum > Using Arduino > Project Guidance > Using a switch & LED to drive input pin
arduino
Comments
Post a Comment