waking up arduino from sleep mode using a button

Hi,

In my latest project I am using two buttons and a servo (one button moves the servo to the right 10 degrees and the other to the left) with an arduino board connected to an external power supply.
I need the battary to run for as long as possible, and I read online that sleep mode is the way to save battary.
I searched online but I didnt find a way to make the arduino sleep for an unlimited amount of time until a button is presses- in that case the arduino wakes up and moves the servo left or right.
I would appreciate if someone can explain how to do that or even better- write a code for me.

thanks a lot!
shak0706

Sleep mode will save some current in the '328P itself - but will not help for the voltage regulators, the power on LED, the USB/Serial interface, or power to the servos.

You really need a standalone design and a transistor that can turn off servo power.
Search "power down sleep mode" in the Playground, there are examples to enter sleep mode and then use an interrupt input to wake from sleep.

can you expand?

http://playground.arduino.cc/Learning/arduinoSleepCode

Do you need to keep the servo powered during the 'sleep' time? If so, the Arduino power consumption is probably not the critical factor here.

If you can afford to power down the servo then one option would be to get rid of the bootloader and connect a pair of twin-pole momentary switches that power the Arduino and control a digital input signal. By eliminating the bootloader, you could get the Arduino to power up and run almost instantly at the press of a button. It would need to remember the current servo position between power cycles, and I'd do that by writing it to EEPROM each time it changed, then read the previous position back from EEPROM at boot time and increment/decrement it according to which button was pressed.