74Views3Replies

Author Options:

running a loop in arduino program Answered

I want to run a loop only upon taking the user input i.e whenver user gives input, the loop must run N times where N is the user input. Can i do so? please suggest with the code.

Comments

The forums are retiring in 2021 and are now closed for new topics and comments.
0
rickharris
rickharris

5 years ago

Get user input

|

store in a variable

|

call the loop subroutine

|

in the subroutine use the variable you have the number of loops stored in as a for next loop limit

so in pseudo code something like this.

Get input

Store in XX

--------------------------

Gosub loop

For loop = 1 to XX

rest of loop code

Next loop

return

0
iceng
iceng

Answer 5 years ago

+1, +2, +3,

Sometimes I feel looped :)