I am new in arduino programming.
I tried to find but failed what is a role of loop() function.
Obviously I know that it is called "in loop" while the machine (hardware and "OS") is working.
But I want to have some deeper understanding:
1 - is it important always to exit from loop() allowing the machine to cycle?
2 - how long is it safe to stay in loop() ?
Can I create my infinite loop in loop()
Will the machine work well?
3 - Can I create my infinite loop in setup() so the machine never enters loop() ?
3 - what the machine does after program leaves setup() but not yet entered into loop()?
4 - what the machine does after program leaves loop() before next entering into loop()?
Thanks!
I tried to find but failed what is a role of loop() function.
Obviously I know that it is called "in loop" while the machine (hardware and "OS") is working.
But I want to have some deeper understanding:
1 - is it important always to exit from loop() allowing the machine to cycle?
2 - how long is it safe to stay in loop() ?
Can I create my infinite loop in loop()
Code:
void loop() {
while (true){
doSomething();
delay(100);
}
}
3 - Can I create my infinite loop in setup() so the machine never enters loop() ?
Code:
void setup() {
while (true){
doSomething();
delay(100);
}
}
void loop() {}
3 - what the machine does after program leaves setup() but not yet entered into loop()?
4 - what the machine does after program leaves loop() before next entering into loop()?
Thanks!