I’m not an Arduino expert, but I have used it some.
SimonPuleo:
Does “setup()” always run first and only once?
Yes.
SimonPuleo:
Does loop run at the clock-speed of the chip?
loop() cycle time is the core clock speed divided by the cycles required to execute all of the instructions in the loop() statement.
SimonPuleo:
Does it basically loop forever?
Yes
SimonPuleo:
If I only want an instruction to happen once then it needs to be in a ‘for’ or ‘if’ statement is that correct?
Yes, it would need to be in some kind of conditional statement. If it only needs to run once, maybe setup() might be a good place to execute it. Depends on what it’s doing.
SimonPuleo:
What parameters does “loop()” take that are useful to beginning programs?
loop() doesn’t take any paramaters that I’m aware of… but I’m no expert.
While the instructions inside the loop() run at clock speed, the loop() includes extra overhead (ckecking for events) after each execution. If you want your loop to repeat the fastest, use an always-true FOR loop.This won’t change the execution speed between commands in the loop, but will skip the overhead and will loop faster.