Study for the Internet of Things (IOT102) Test. Access comprehensive flashcards and multiple choice questions, each with hints and explanations. Get prepared for your exam!

Multiple Choice

In an Arduino sketch, which function is executed once when the board starts up?

In an Arduino sketch, initialization happens in a function that runs exactly once when the board starts. That function is setup. The Arduino core provides a main function behind the scenes that calls setup once at startup and then enters loop, which runs repeatedly for the life of the program. Put one-time initializations like setting pin modes or starting serial communication in setup, and put code you want to run repeatedly in loop. The other options aren’t part of the Arduino sketch API: main is handled by the core, and Run or Initialize aren’t used in this environment.

In an Arduino sketch, initialization happens in a function that runs exactly once when the board starts. That function is setup. The Arduino core provides a main function behind the scenes that calls setup once at startup and then enters loop, which runs repeatedly for the life of the program. Put one-time initializations like setting pin modes or starting serial communication in setup, and put code you want to run repeatedly in loop. The other options aren’t part of the Arduino sketch API: main is handled by the core, and Run or Initialize aren’t used in this environment.