How to pause the execution of the code using Arduino IDE with microseconds
4 January, 2019 by
How to pause the execution of the code using Arduino IDE with microseconds
Alejandro Jabalquinto

Introduction

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

The function for pausing the execution code for a certain time in聽microseconds using聽Arduino IDE聽is聽delayMicroseconds()聽 This function is used to set a time of pause.


Requirements

Ethernet or 20 I/Os PLC:聽 聽 聽聽Ethernet PLC聽 聽 聽20 I/Os PLC聽聽聽聽聽

Industrial Shields boards:聽聽Industrial Shields Boards


Function

delayMicroseconds(Microseconds)


Parameters

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


Example

Code Example, blinking of analog outputs every 0,5ms:

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

void loop() {
  analogWrite(A0_5, 0);
  delayMicroseconds(500);         // delay 0,5ms
  analogWrite(A0_5, 255); 
  delayMicroseconds(500);
}

Find what you are looking for
Search in our Blog

How to pause the execution of the code using Arduino IDE with microseconds
Alejandro Jabalquinto
4 January, 2019
Share this post
Archive

Looking for your ideal Programmable Logic Controller?

Take a look at this product comparison with other industrial controllers Arduino-based. 

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.


Industrial PLC comparison >>>

Do you want more information?

Just fill the form!

Tell me more!