Advertisement
microrobotics

Untitled

Apr 29th, 2023
1,877
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Servo.h>
  2.  
  3. Servo myServo;
  4.  
  5. void setup() {
  6.   myServo.attach(9); // Attach servo to pin 9
  7. }
  8.  
  9. void loop() {
  10.   myServo.writeMicroseconds(1500); // Stop the servo
  11.   delay(1000);
  12.  
  13.   myServo.writeMicroseconds(1700); // Rotate clockwise
  14.   delay(1000);
  15.  
  16.   myServo.writeMicroseconds(1300); // Rotate counterclockwise
  17.   delay(1000);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement