Stuck in a loop

Hi all,

I am seeking help with a project I am attempting and have run into an issue I've had trouble finding an answer for. What I am trying to do is have six push buttons that activate a different loop of code when each button is pushed.

I have wired my push buttons to a single input recognizing which button is pressed depending on the resistance value returned as instructed in this guide https://www.the-diy-life.com/multiple-push-buttons-on-one-arduino-input/

That's all good and functioning. The issue that I'm having is that when I push one of the buttons the analog read function stops while that if loop is in progress and I cannot activate any of the other loops until that loop has finished. What I need to do is have them be executable simultaneously. Is this something that is possible to do?

Here's my code: https://pastebin.com/py3uxnFT

Any help or just a simple point in the right direction would be greatly appreciated. Thank you for reading.

Touch here for the full post on the Arduino Apprentices tumblr

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s