I'm not sure you understood my comment. Instead of putting your code in loop() put it into setup(). In this case loop() is empty and you don't care how often it's called.
people asking for such a function/define need to learn a bit more about programming, and spent more time on the tutorial and reference section. I think the question will still be asked even if it was part of the language. Its in the nature of tinkerers
by the way I would call it STOP #define STOP() while(true)
There are many more of this kind of #defines like
#define REPEAT do { #define UNTIL(x) }while(!(x));
I once saw a set of defines to create a string switch
SWITCH(string)
{
CASE("monkey") : ...
BREAK;
CASE("fish") :...
BREAK;
DEFAULT ....
BREAK;
}
implementation left as an exercise for the reader ....
First, "noLoop()" versus "exit(0);". The former requires either defining the macro or an addition to the Arduino software. The latter is ready to use. The former leaves the interrupt flag alone which potentially allows the Sketch to limp along. The latter disables interrupts effectively shutting down all execution. They are the same number of characters to type. I think I'll go with the latter.
Second, if you're going to stop execution, you really should put the processor to sleep. (exit does not)
sixeyes:
I'm not sure you understood my comment. Instead of putting your code in loop() put it into setup(). In this case loop() is empty and you don't care how often it's called.
The "while ( true )" should not be necessary but I've dealt with enough "should nots" in my life to know that including it is worth the two (or four) bytes of Flash.