/*Interface a servo motor with NodeMCU to rotate it from 0 degree to 45 degree and to 90
degree and then back to 0 degree.*/
#include <Servo.h>
int x;
Servo myservo;
void setup() {
pinMode(27, INPUT);
myservo.attach(25);
myservo.write(0);
delay(2000);
}
void loop() {
x=analogRead(27);
myservo.write(45);
delay(1000);
myservo.write(90);
delay(1000);
myservo.write(0);
delay(1000);
}