Arduino Programming Language: Loop

Name

loop()

Description

Continuously executes the lines of code contained inside its block until the program is stopped. The loop() function is used in conjunction with setup(). The number of times loop() executes in each second may be controlled with the delay() and delayMicroseconds() functions.

Syntax

loop() {
statements
}

Parameters

  • statements
  • A sequence of statements to be executed over and over again

Returns

none 

Usage

Application

Examples

void setup()
{
pinMode(WLED, OUTPUT); // set the on-board LED pin as output
}

void loop()
{
digitalWrite(WLED, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(WLED, LOW); // set the LED off
delay(1000); // wait for a second
}

Related Functions


Based on the reference originally written by Arduino Community,  wiring.org.co and  arduino.cc