START STOP of program

I need my arduino to start a cycle on a specific time and stop at a precribe time.

How should I go about?

With a real-time clock (RTC) module, perhaps.

What have you tried? Why didn't it work for you?

Keep in mind that a program doesn't simply stop. Once setup() is done, the loop() routine runs forever, until it is turned off, reset, burned down or destroyed with an ax. loop() is called several hundreds or thousand times every second.

What you must do is to have controls inside your loop() routine to weather it must do something in that cycle or not.

Have a look on my project Pet Robot Toy

Stops fine 8)

AndreasVan: Have a look on my project Pet Robot Toy

Stops fine 8)

if(millis() >= 50000) { while(1) { } } }

This is not stopping. This is running a code that does nothing. It is quite different from completely stopping. In your code, the Arduino is still running at full power, but not performing anything useful.

Actually, I will correct my previous post: there is way to make an AVR stop, but it has nothing to do with "codeless" loops: you put it to sleep or power it down.

Even AndreasVan's code could be quite optimized if, instead of entering an infinite codeless loop, he would put the MCU to sleep or power it down. The upside is that power consumption during a sleep is minimal.

Nick Gammon has written an excellent article on the subject: http://www.gammon.com.au/power

When you ask a one liner question with a big topic and no details whatsoever, you shouldn't be surprised when the answers you get aren't exactly what you are looking for.

What are you trying to accomplish? Stop the arduino dead in its tracks or put it to sleep where it can be woken up? You really weren't clear about that in your original question.