69Views3Replies

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.

Discussions

0
rickharris
rickharris

4 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 4 years ago

+1, +2, +3,

Sometimes I feel looped :)

0
rickharris
rickharris

Answer 4 years ago

:-)