Go Down

Topic: IF statement to be used inside FOR loop with sensor input (Read 5798 times) previous topic - next topic

mrameshwaram

hello,
I am new to Arduino,

I want to do the following stuff in Arduino:

1. Read the signal from sensor and will store it as x. for example x=6.

2. if x=6, "I want to run two motors one after another after getting a signal from IR sensor and stop". This process  should run for X=6 times after each signal input from IR sensor.
I tried this so many times with IF statement inside FOR loop but failed.

3.The loop should end and wait for next X value. It may be 6 or 12 or any thing.

your help will be appreciated.

TheMemberFormerlyKnownAsAWOL

#1
May 27, 2020, 06:30 pm Last Edit: May 27, 2020, 06:31 pm by TheMemberFormerlyKnownAsAWOL
Post what you already tried.

Tell is why it fell short of your expectations.
Please don't PM technical questions - post them on the forum, then everyone benefits/suffers equally

Go Up