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]
#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
0 B
|👍
/👎