#include <Servo.h>
Servo myservo; // create Servo object to control a servo
// twelve Servo objects can be created on most boards
int pos = 0; // variable to store the servo position
void setup() {
myservo.attach(PA10); // attaches the servo on pin 9 to the Servo object
}
void loop() {
// goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(0); // tell servo to go to position in variable 'pos'
delay(15); // waits 15 ms for the servo to reach the position
// goes from 180 degrees to 0 degrees
myservo.write(90); // tell servo to go to position in variable 'pos'
delay(15);
myservo.write(180); // tell servo to go to position in variable 'pos'
delay(15); // waits 15 ms for the servo to reach the position
}