Screen saver mode

Okay I'm not talking about the fly toaster on the computer monitor. Sorry if I mislead you but I didn't know how to phrase it correctly. I recently build a game for my son, a "Simon says" machine. It's an interactive memory game with push buttons, led lights and a speaker. You know what I'm talking about... It works great for young kids. So here is my question, I been trying to find a way to have it so that after 3 mins of inactivity, it goes into a 'screen saver' mode. Perhaps a looping LED light show, a perfect night light for my 4 yr old son. I been doing some searching but I can't seem to get a grasp on what I need to do. I appreciate it if someone can point me the right direction.

By the way, I used the sketch from: http://www.instructables.com/id/Arduino-Simple-Simon-Says-Game/

Thanks in advance!

I been trying to find a way to have it so that after 3 mins of inactivity, it goes into a 'screen saver' mode.

How do you define "inactivity"? How do you measure "activity" to see if it is happening?

Once you can answer those questions, the code is trivial.

As @PaulS says the difficult thing may be to define inactivity.

If you want it to go into a different mode if no button is pressed for a certain time you could do it like this.

if (currenMillis - lastPressedMillis >= inactivePeriodMillis) {
  // do the inactive thing
}
else {
  // do the active thing
}

and the trick is that every time a button is pressed you do lastPressedMillis = currentMillis; to update the value and restart the clock. By the way currentMillis = millis(); will be at the top of loop(). And this assumes that your code allows loop() to repeat very frequently - hundreds or thousands of times per second.

...R

Thanks guys, I think that's the key. I have to figure out how to define inactivity and use currentMillis = millis at the beginning of the loop. I think figuring out how to 'wake-up' from the screen saver mode should be easy enough.

Each time the user presses a button, save the value of millis().

If no buttons are pressed, check millis(). If over 3000, enter screen saver mode.

Tommy72a: I think figuring out how to 'wake-up' from the screen saver mode should be easy enough.

You should not have to do anything. A button-press should do it.

...R