Hello guys, I have a doubt among the following statements to my work:
Alternative 1:
"The setup () method contains the code block where the variables to be used in programming are defined and the loop () method contains the code block where the program execution actually happens."
Alternative 2:
"The loop () method contains a block of code that executes infinitely unless the arduino is turned off or is pressed the reset button on the board or a new program is loaded on the platform as well as the setup () method includes the block responsible for creating the initial state of the whole execution of the program code. "
After all, which of the two statements is true? Both seem correct.
2 is more correct. 1 is confused. "Execution" happens in both setup and loop. It is quite possible to put all the code into setup() and leave loop empty if you only want a thing done once.