i only wanted to execute sweep code 2 times what is wrong here nothing is happening all the pins are correct to
the code:
#include <Servo.h>
Servo myservo;
void setup() {
myservo.attach(9);
servoTurn(2);
}
void loop() {
}
void servoTurn(int x){
int pos = 0;
for(int i;i<x;i++){
for (pos = 0; pos <= 180; pos += 1) {
myservo.write(pos);
delay(15);
}
for (pos = 180; pos >= 0; pos -= 1) {
myservo.write(pos);
delay(15);
}
}
Thanks for everybodies responses