servo write not working after timer interupt

Hi guys,

I tried an application from http://www.instructables.com/id/Connect-Arduino-Uno-to-Android-via-Bluetooth/ (might be not related) and after that I am having problem with servo.

I tried simple code to move the servo to one angle and after that to another. The servo unfortunetly moves by very little steps (almost not).

I tried to plug 360 servo. This one spines (slowly) continuesly and does not stop at all.

When I look to device manager. The list keeps refreshing and when I try to reupload the code it throws me an error:
avrdude: ser_send(): write error: sorry no info avail

Any ideas?

Thanks a lot.
Michal.

System:

  • win7 64bit
  • ArduinoUno
  • ArduinoIDE version 1.6.11

Code:

#include <Servo.h>

Servo myServo;

int servoPin = 9;

void setup() {
  myServo.attach(servoPin);
  Serial.begin(9600);
}

void loop() {
  myServo.write(30);
  delay(500);
  myServo.write(140);
  delay(500);
}

How are you powering the servo?

DO NOT power it from the Arduino 5v pin as that pin cannot provide enough current.

The problem sounds as if the servo is causing the Arduino to reset frequently because it is drawing too much current from the 5v pin.

Give the servo its own power supply with a common GND with the Arduino.

...R