#include Servo myservo; // create servo object to control a servo void setup() { myservo.attach(D0); // attaches the servo on pin 9 to the servo object } void loop() {; myservo.write(180); for(int i = 180; i > 90; i--){ myservo.write(i); delay(100); } delay(1000); for(int x = 90; x < 180; x++){ myservo.write(x); delay(100); } delay(1000); }