sg90
The PWM value for SG90 is 500µs (0°) to 2400µs (180°). Some clones may use 544µs to 2400µs.
#include <Servo.h>
Servo myservo; // create Servo object to control a servo
int deg;
void setup() {
Serial.begin(9600);
myservo.attach(D5, 500, 2400); // Custom min/max pulse widths
deg = 0;
myservo.write(90); // Center position
}
void loop() {
for (int angle = 0; angle <= 180; angle += 30) {
Serial.print("Moving to: ");
Serial.println(angle);
myservo.write(angle);
delay(1000);
}
}
sg90.txt · Last modified: by 127.0.0.1
