+ 1

How to define the function and how to create that??

If I have to run 8 servo motors and I don't want to write everytime to move 90° then 180°,how I call the function??

22nd Dec 2017, 4:25 PM
Roshan Bhuvad
Roshan Bhuvad - avatar
1 ответ
+ 2
It depends how you are setting up your code. But, you could use an infinite loop that just continuously checks your conditions, and it will automatically call your write functions to accomplish this. Perhaps you can make a Boolean object called doContinue and use a while loop to see if the programming keeps running. For example, while(doContinue) {something} Perhaps you can also have a counter in the while loop or a condition that makes doContinue false when you are done with your loop. Or, better yet, within your loop(), place your code, and make sure to put a delay(), where delay is in milliseconds, so that it will keep running your code but pause for a certain amount of time in between. Arduino StackOverflow has some examples of this, here is one: https://arduino.stackexchange.com/questions/45298/servo-motor-activation-with-pressure-sensor
23rd Dec 2017, 12:03 AM
Mohamed
Mohamed - avatar