Arduino - Easter Egg Dyeing

You know that modern eastern egg dyes requires about 5 minutes to make super bright eggs. It also takes about 5 minutes and 10 lines of code to create the countdown timer with left minute display on arduino.
The schematic diagram is more than simple. Just connect 5 or more green LEDs on ports 0-7 and one red LED on port 8.

Here is photo of my assembled board.

Is it possible to make the code shorter?!
/*
  Arduino - count down timer
*/

int MAX_LEDS = 5; // max_leds = maximun minutes
int counter = 60 * MAX_LEDS; 
bool flip_flop = LOW;

void setup() {
  
   DDRB = DDRC = DDRD = 255; // set all ports to output
   PORTD = (((unsigned int)1 << MAX_LEDS) - 1); // ON first N LEDs

   while(counter--){
    delay(1000);  // wait for a second
    flip_flop = flip_flop == LOW ? HIGH : LOW;
    digitalWrite((int)(counter/60), flip_flop); // blink current minute LED
   }

   while(true){
    delay(1000);  // wait for a second
    flip_flop = flip_flop == LOW ? HIGH : LOW;
    digitalWrite(8, flip_flop); // blink red light
   }
}

void loop() {

}

and video

Enjoy!

No comments:

HOWTO: Repair Logitech M325 Mouse

FixIt says that you will find single screw under CE label. It isn't always true.