Servo jitter and power down interrupt

Hi all,

I'm trying to control a servo when my Arduino UNO R3 wakes up from an interrupt on pin 2, but the servo starts jumping around when it is in rest. I copy-pasted "sketch J" from Nick Gammon's website: Gammon Forum : Electronics : Microprocessors : Power saving techniques for microprocessors, removed the LED part and attached a servo instead. As soon as the myservo.attach(10) code is implemented and a LED is connected to pin 10, it starts blinking every second (servo jitter). When a servo command is placed in the void loop the led starts blinking much faster.

Example:

#include <avr/sleep.h>
#include <Servo.h>

Servo myservo;
void wake ()
{
  // cancel sleep as a precaution
  sleep_disable();
  // must do this as the pin will probably stay low for a while
  detachInterrupt (0);
}  // end of wake

void setup () 
  {myservo.attach(10);
  digitalWrite (2, HIGH);  // enable pull-up
  }  // end of setup

void loop () 
{  // disable ADC
  ADCSRA = 0;  
  
  set_sleep_mode (SLEEP_MODE_PWR_DOWN);  
  sleep_enable();

  // Do not interrupt before we go to sleep, or the
  // ISR will detach interrupts and we won't wake.
  noInterrupts ();
  
  // will be called when pin D2 goes low  
  attachInterrupt (0, wake, LOW);
 
  // turn off brown-out enable in software
  // BODS must be set to one and BODSE must be set to zero within four clock cycles
  MCUCR = bit (BODS) | bit (BODSE);
  // The BODS bit is automatically cleared after three clock cycles
  MCUCR = bit (BODS); 
  
  // We are guaranteed that the sleep_cpu call will be done
  // as the processor executes the next instruction after
  // interrupts are turned on.
  interrupts ();  // one cycle
  sleep_cpu ();   // one cycle

  } // end of loop

How to solve this?

Thanks!

(deleted)

As soon as the myservo.attach(9) code is implemented

You don't have any code there that attaches a servo to pin 9. Read your own code.

Servo is powered with 4 aa batteries, separately from the arduino (ground is shared).
Sorry I mean pin 10 instead of 9, corrected.