Can I include while loops and if statements in the void setup() routine?
Yes. The setup() function is a function like any other (so is loop()). So you can put anything in setup() that you would put in any function.
KerneelsM:
Can I include while loops and if statements in the void setup() routine?
You can include anything that is valid in C++.
Yes!
setup() is a normal C/C++ function, called by the mysterious part of Arduino.
It can have or do anything that is valid anywhere. It needn't even ever return, although then you'd never get to the continuous loop() calls.
loop() is also a normal C/C++ function, it's just the one that is called continuously. It can do anything, it needn't return, &c.
HTH
a7
KerneelsM:
Can I include while loops and if statements in the void setup() routine?
Have you looked at any of the standard example sketches that are included with the IDE?
KerneelsM:
Can I include while loops and if statements in the void setup() routine?
One method to make a program run once then "halt" is to put all the code into the setup() function, and nothing in the loop() function. (You do need both in your sketch or the compiler will complain.)
Thanks to you all.