Arduino Tower Pro SG90 连续旋转伺服控制
Arduino Tower Pro SG90 Continuous rotation servo Control
我有 Hacked Tower SG90 可以连续旋转。我可以控制它向前和向后运动。但我不知道如何停止伺服。我正在使用 arduino nano 来控制伺服。这是我的代码:
#include <Servo.h>
Servo myservo; // create servo object to control a servo
void setup() {
myservo.attach(14);
}
void loop() {
myservo.write(0); // for forward motion
delay(1000);
myservo.write(180); // for backward motion
delay(1000);
}
myservo.write(90)
Writes a value to the servo, controlling the shaft accordingly. On a
standard servo, this will set the angle of the shaft (in degrees),
moving the shaft to that orientation. On a continuous rotation servo,
this will set the speed of the servo (with 0 being full-speed in one
direction, 180 being full speed in the other, and a value near 90
being no movement).
我有 Hacked Tower SG90 可以连续旋转。我可以控制它向前和向后运动。但我不知道如何停止伺服。我正在使用 arduino nano 来控制伺服。这是我的代码:
#include <Servo.h>
Servo myservo; // create servo object to control a servo
void setup() {
myservo.attach(14);
}
void loop() {
myservo.write(0); // for forward motion
delay(1000);
myservo.write(180); // for backward motion
delay(1000);
}
myservo.write(90)
Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with 0 being full-speed in one direction, 180 being full speed in the other, and a value near 90 being no movement).