HOW TO PAUSE THE EXECUTION OF THE CODE WITH ARDUINO IDE with microseconds

HOW TO PAUSE THE EXECUTION OF THE CODE WITH ARDUINO IDE with microseconds

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 pause the execution code for a certain time in microseconds using Arduino IDE is delayMicroseconds()  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

delayMicroseconds(Microseconds)

Parameters

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

Example

Code Example, blinking of an 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)
}

SEE ALSO:

HOW TO USE THE MAPPING PINS OF INDUSTRIAL SHIELDS BOARDS

Los comentarios están cerrados