i am working on arduino Nano and using simple sweeping code which is as below.
while servo sweeps some times then it stops and built-in LED " L " start blinking 4-5 sec after then servo starts sweeping again. this circumstance goes to loop.
I don`t see any reason in the code the Nano being delay randomly.
do you think the nano has defecet?
#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(8); // attaches the servo on pin 9 to the servo object
}
void loop()
{
myservo.write(0); // tell servo to go to position in variable 'pos'
delay(1500);
myservo.write(180); // tell servo to go to position in variable 'pos'
delay(1500);
}