use of exit(0)

On Arduino, the statement:

exit(0);

Compiles to be:

cli(); //disable interrupts
while(1); //forever loop

It basically stops your program running, but leaves the CPU running in an infinite loop. Personally I think it would be better if the exit() function put the chip into deep sleep mode.

2 Likes