Servo Motor
1.DC servo motor
2.AC servo motor
3.Brushless DC servo motor
4.Positional rotation servo motor
5.Continuous rotation servo motor
6.Linear servo motor
NodeMCU
Pin Configuration of NodeMCU
#include <Servo.h>
Servo myservo;
void setup() {
myservo.attach(D1); // ATTACH SERVEO TO D1 PIN
}
void loop() {
int pos;
for (pos = 0; pos <= 180; pos += 1) { // it goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos);
delay(15);
}
for (pos = 180; pos >= 0; pos -= 1) { // it goes from 180 degrees to 0 degrees
myservo.write(pos);
delay(15);
}
}