Push button trigger sequence

Hi Everyone,

I am new to Arduino and trying to do a project. I have One push button (momentary) on Pin A2 and other side to Ground.

I have an LED setup on Pin A3.

I want to detect the button press and have different reactions.

If button has short press, turn On LED and run a routine (activate pin 2,3,4,5 for 10 sec, then turn Off)

If button has long press (3 sec), Blink LED and run another routine (activate pin 6,7,8,9 for 10 sec, then turn Off)

At anytime during any of the routines I would like the button to Exit the routine and be ready for the next short or long press detection.

Thanks in advance

You seem to need to know when the button becomes pressed and when it becomes un-pressed. Do you have pin A2 coded as input PULLUP?
Please include you code.
Paul

Why that setup? It will never work.

an LED setup on Pin A3..... Why an analog port?

You would be better off trying some beginners guided exercises.

1 Like

Why not? :face_with_raised_eyebrow:

The reason why I am using the analog pins is because pin 2 to 13 are triggering relays which are part of the sequence that I need to trigger.

My current code is pretty much a bunch of code taken left and right patched together to try to achieve the results.

It matters not where you got the code, if you want help with it we need to see it. Read the forum guidelines to see how to properly post code.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Tell us what the code actually does and how that differs from what you want.

Post a schematic as well, please.

this is a nice school assignment, when does it have to be handed in?