how to make arduino nano pro low power

hi all

I just want to make this arduino code set to low power. normally it consume 20ma. i want to reduce it. how to do it.

################################################################

const int buttonPin = 2;
const int ledPin = 13;

byte ledFlag = 0;
byte enableFlag = 0;
unsigned long ledTime;
unsigned long flashTime;
const unsigned long flashRate = 100UL;

int buttonState = 0;

void setup()
{

pinMode(ledPin, OUTPUT);

pinMode(buttonPin, INPUT_PULLUP);
}

void loop()
{
buttonState = digitalRead(buttonPin);

if (buttonState == HIGH && ledFlag == 0)
{
digitalWrite(ledPin, HIGH);
ledFlag = 1;
enableFlag = 1;
ledTime = millis();
flashTime = millis();
}

if (enableFlag == 1 && millis() - ledTime <= 4500UL)
{
if (millis() - flashTime >= flashRate)
{
flashTime = millis();
digitalWrite(ledPin, !digitalRead(ledPin));
}
}
else
{
enableFlag = 0;
digitalWrite(ledPin, LOW);
}

if (buttonState == LOW)
{
ledFlag = 0;
enableFlag = 0;
digitalWrite(ledPin, LOW);
}

}

Have you considered sleep mode?
Type "sleep" in the search box at top of page.
Good luck.

FT232 draws power.
Regulator draws power.
Power LED draws power.
Start with a board that doesn't include those parts:


Running at 8 MHz, or even slower at 1 MHz, will save power also.
Do some reading here to learn about going into Power Down Sleep mode and turning off unused internal circuits:

@manjulaa, after 17 posts you should be well aware that you need to post your code between code tags, not inline in your post.

CrossRoads:
FT232 draws power.
Regulator draws power.
Power LED draws power.
Start with a board that doesn't include those parts:


Running at 8 MHz, or even slower at 1 MHz, will save power also.
Do some reading here to learn about going into Power Down Sleep mode and turning off unused internal circuits:
Gammon Forum : Electronics : Microprocessors : Power saving techniques for microprocessors

thanks

Not going to correct your original post and place the code between code tags? I see you chose to ignore that suggestion. Try reading the "How to use this forum" post at the top of the index page for this forum. It's required reading.
Many of us get very sick of continually having to decipher badly formatted and placed 'inline' code', just because people cannot be bothered to read the "How to use..." posts