noLoop()

Tried a lot of searching, but was not able to find a solid answer. :'(

Is it possible to get something like the noLoop() function in processing for arduino? Or is there anyway to achieve the same effect? I basically don't want to loop over and over, but rather have the program execute more like a main() in c/c++.

It won't match the noLoop() behaviour exactly but if you put all your code in setup() and leave loop() empty the code will run once.

--Phil.

If you never return from loop(), it will work just like main() ...

Having loop() clarifies a relatively common beginner microcontroller misunderstanding, eg "what happens when my program stops?" It DOESN'T stop. At least with loop(), you are clued in that it LOOPS!

The main() in c will look like this:

void main()
{
      while(1)
         loop();
}

It is the nature of controllers that they loop. What exactly are you trying to achieve? How do you envision the code? Perhaps post some pseudo code of your desired main and we will help you convert it to the loop.

Basically what you posted, but without the infinite while(1). I want the main to go through once.

Basically what you posted, but without the infinite while(1). I want the main to go through once.

As already stated just put all your sketch code into the setup section and leave the loop section empty.

Lefty

Will give it a try, thanks for the help guys. Sorry for the noobness ;D

I realize that my above post with the pseudo-esque main code is inaccurate.

Dan, heres what the actual main looks like. Still pseudo-esque:

void main()
{
      setup();
      
      while(1)
         loop();
}

Notice how it calls the setup function first and then goes on to infinitely loop the loop.