Switch With Led

Hey Programmers,
I am stuck rn,

I'm using limit switch with two pins, and i want my led to turn on for 1 minute when limit switch is not pressed. In my case limit switch would be pressed the whole time and when its not pressed led should turn on for 1 minute then it should turnoff irrespective of limit switch condition whether switch is pressed or not.

Hello,

what did you try? how are things wired?

➜ do yourself a favour and please read How to get the best out of this forum and post accordingly (including code tags and necessary documentation of your ask).

I hvnt tried coding yet bcz i cant think anyhting
and for wiring
it just momentary limit switch with two pins and a led

read about finite-state machine (FSM).

You probably want to consider an N/O switch, if it’s being constantly pressed (to relieve pressure on the internal mech), or a non-mechanical switch, like opto or hall-effect.

Hi, @firechamber

What model Arduino are you using.
What pins do you have the limit switch connected too?
What pins do you have the LED and its series current limit resistor connected to?

Can you post a circuit diagram, a hand drawn schematic is fine.

What is your limit switch, can you post link to specs/data?

Thanks.. Tom... :grinning: :+1: :coffee: :australia:

The switch will be pressed the whole time and when return to its "not pressed" condition for some reason then led should turn on for some time and then it should turn off irrespective of switch is pressed or not.

Hey @TomGeorge

I'm using Uno
for switch, pins are: 5v arduino and pin8 digital
for led, one pin is connected to resistor with 13 and cathode to gnd!
i have attached picture of switch im using

Hi,
Thanks for the information. :+1:

You will need a 10K resistor between pin8 and Uno gnd, so that pin 8 has 5v or gnd potential on it.
If you don't have a 10K pull down resistor, when your switch is open then pin8 will probably stay at the 5V potential, instead of going LOW to gnd.

Can I suggest you just write some code to turn your LED on and off as you activate the switch?

This will prove your circuit before getting into timing for the response to the button.

Thanks.. Tom.. :grinning: :+1: :coffee: :australia:

Hello
Did you post your current sketch already?