#include <Servo.h>
Servo svrmotor;
int angle=0;
void setup() {
// put your setup code here, to run once:
svrmotor.attach(9);
svrmotor.write(0);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
while (angle<180){
svrmotor.write(angle+15);
delay(200);
angle+=15;
Serial.println(angle);
delay(300);
}
while (angle>0){
svrmotor.write(angle-15);
delay(200);
angle-=15;
Serial.println(angle);
delay(300);
}
}