loop()

Description

After creating a setup() function, which initializes and sets the initial values, the loop() function does precisely what its name suggests, and loops consecutively, allowing your program to change and respond. Use it to actively control the Arduino board.

Example Code

void setup() { // put your setup code here, to executed once: Serial.begin(9600); Serial.println("This is setup code"); } void loop() { // put your main code here, to run repeatedly: Serial.println("This is loop code"); delay(1000); }

The output on Serial Monitor:

COM6
Send
This is setup code This is loop code This is loop code This is loop code This is loop code This is loop code This is loop code This is loop code
Autoscroll Show timestamp
Clear output
9600 baud  
Newline  

See Also

ARDUINO BUY RECOMMENDATION

Arduino UNO R3
Arduino Starter Kit
Please note: These are Amazon affiliate links. If you buy the components through these links, We will get a commission at no extra cost to you. We appreciate it.

※ OUR MESSAGES