setup() vs. loop()?

Hi Becky.

If I wanted to execute a function only once, is it correct to place it in setup instead of loop? I tried it and it worked, but I was wondering if that is the correct way.

bekathwia6 months ago

If you want something to execute once at the beginning of the program, you are correct to put it in the setup, but there are ways to program things in the loop to only execute once as well. Lots of ways to accomplish the same thing!