Tower Pro SG90 servo

SG90 powered from a 800mA 5V plug pack.

SG90 won't move.

Suggestions?

Default pulse width in the library wrong fro this servo? Tried setting it to 500us and 1000us and it still won't move.

If so what should the pulse width be.

/* Sweep
 by BARRAGAN <http://barraganstudio.com>
 This example code is in the public domain.

 modified 8 Nov 2013
 by Scott Fitzgerald
 http://www.arduino.cc/en/Tutorial/Sweep
*/

#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(9);  // attaches the servo on pin 9 to the servo object
  Serial.begin(115200);
}

void loop() 
{
  for (pos = 0; pos <= 180; pos += 1) 
  { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
    Serial.print(F("XXXXXXXXX "));
    Serial.println(pos);
  }
  for (pos = 180; pos >= 0; pos -= 1) 
  { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
    Serial.print(F("ZZZZZZZZZ "));
    Serial.println(pos);
  }
}

Grounds connected?
Battery charged?
Does the plug pack have a minimum current shutoff?
Can the plug pack handle the start/stall current?

I use one of those for Q&D testing all the time, just using servo.write(pos) with degrees, works fine.

Don't tell anyone, but I've been known to power it off the Arduino 5V pin with no load.

Presumably your XXXX and ZZZZ are printing so the ifs are working?

Is your power supply ground connected to the Arduino ground?

Verily, your code works for me with an SG90, XXXX and ZZZZ and all.

The issue you are experiencing may be caused by lack of power and/or missing common ground. Try this code as a test:

void loop()
{
  myservo.write(180);
  delay(2000);
  myservo.write(0);
  delay(2000);
}

jremington:
Grounds connected?
Battery charged?
Does the plug pack have a minimum current shutoff?
Can the plug pack handle the start/stall current?

Mains plug pack not battery - 5V 800mA.

GNDs connected.

Plug pack is just a former tablet power supply / charger.

Servo will move when the power is first connected but not there after.

I have had the same servos working with a motor control shield before.

But first time I have tried directly off an Arduino.

Tried a MG90s as well - same - won't move.

Also tried powering it from an ATX power supply - still won't move.

I am completely stumped!

Steady 5V according to my multimeter so the servo is shutting off the power supply.

Try a different pin: maybe you fried pin 9 somewhere along the line.

You didn't say if the XXXX and ZZZZ are showing, to prove the code is working?

Never mind....stupid mistake.....I had changed the pin number in the sketch and had forgotten about it

Probably the GND jumper wire was not connecting properly originally.