microrobotics icon

Arduino sample Code for 360 Degree Servo

microrobotics | PRO | 09/21/24 07:12:27 AM UTC | 0 ⭐ | 16134 👁️ | Never ⏰ | [servo, Arduino Code, 360 degree, ominidirectional]
Arduino |

540 B

|

None

|

0 👍

/

0 👎

#include <Servo.h>
 
Servo myServo;
 
void setup() {
  myServo.attach(9);  // Attach the servo to pin 9
}
 
void loop() {
  // Turn left
  myServo.write(0);  // 0 = full speed counterclockwise
  delay(3000);       // Rotate for 3 seconds
 
  // Stop
  myServo.write(90); // 90 = stop
  delay(1000);       // Wait for 1 second
 
  // Turn right
  myServo.write(180); // 180 = full speed clockwise
  delay(3000);        // Rotate for 3 seconds
 
  // Stop
  myServo.write(90);  // Stop again
  delay(1000);        // Wait for 1 second
}
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎