Advertisement
microrobotics

Untitled

Apr 29th, 2023
1,243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Servo.h>
  2.  
  3. Servo myservo;  // create servo object
  4.  
  5. void setup() {
  6.   myservo.attach(9);  // attaches the servo on pin 9 to the servo object
  7. }
  8.  
  9. void loop() {
  10.   myservo.write(90);  // sets the servo position to 90 degrees
  11.   delay(1000);        // waits for 1 second
  12.   myservo.write(0);   // sets the servo position to 0 degrees
  13.   delay(1000);        // waits for 1 second
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement