Browse our Blog. You will find multiple applications, solutions, code examples. Navigate using the tag cloud or search using specific criteria

How to pause the execution time with Arduino IDE - Milliseconds

In this post it will be seen how to pause the execution code for a certain time.  Basically this function pauses the program for a certain time and after this time it continues as normal. 

The function for pause the execution code for a certain time using Arduino IDE is delay().  This function is used to set a time of pause.

*With next version of Industrial Shields boards won’t be necessary to configure the pins, just selecting the properly board, I/O’s will be automatically configured. 

Function

delay(milliseconds);

Parameters

milliseconds: time expressed in milliseconds -> 1000ms = 1 sec

 

Example

Code Example, blinking of an analog outputs:

void setup() {
  pinMode(A0_5, OUTPUT); // configure A0.5 as OUTPUT
}

void loop() {
  analogWrite(A0_5, 0);
  delay(1000);             // delay 1s
  analogWrite(A0_5, 255); 
  delay(1000);
}


Do you want more information?

Open Source technology allows you to develop your installations.

Just fill the form and we will contact you as soon as we can.

Send