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

quote
is there way connect 5 volts in circuit led , magnetic switch pin turn on relay.
thanks
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.

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

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support