Objectifs

  1. Retard en milliseconde/microseconde
  2. Exemples pratiques
  3. Limitation des fonctions

Retard en milliseconde: delay(NumMillSec)

Exemple 1

unsigned char  count=0;




void setup() {

  Serial.begin (9600);

}




void loop() {

  count=count+1;

  delay(500); //1 seconde

  Serial.println(count);

}

Retard en microseconde: delayMicroseconds(NumMicroSec)

Exemple 2

unsigned char  count=0;




void setup() {

  Serial.begin (9600);

}




void loop() {

  count=count+1;

  for (int i=1; i<500; i++)

      delayMicroseconds(1000); //1/2 seconde

  Serial.println(count);

}

Limitation des fonctions

  1. Durée: µs (65 535, 16 bits), ms(32 bits, 4 294 967 296)
  2. Blocage du programme
  3. Temporisation logicielle (moins précise)
Click to rate this post!
[Total: 2 Average: 5]

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Retour en haut

You have successfully subscribed to the newsletter

There was an error while trying to send your request. Please try again.

FPGA | Arduino | Matlab | Cours will use the information you provide on this form to be in touch with you and to provide updates and marketing.