Task
Create a program to sweep the servo back and forth between 0o and 180o gradually such that it takes a total of 18 seconds to complete a back and forth sweep
Hint
- Increment and decrement by 1o, with a 50 milliseconds delay at each step
Solution
theme | Confluence |
---|
#include <Servo.h>
Servo myservo;
|
|
// variable to store the servo position
void setup()
|
|
for(pos = 0; pos <= 180; pos++)
{
|
|
for(pos = 180; pos >= 0; pos--)
|
|
}
]] ></ac:plain-text-body></ac:structured-macro></div></td><td><div class="content-wrapper"><p><ac:image ac:height="250"><ri:attachment ri:filename="image2020-1-20_18-8-41.png" /></ac:image></p></div></td></tr></tbody></table><p><br /></p><p><br /></p><p><br /></p> | Image Added |