Skip to content

Best approach to execute tasks every 100 ms (or multiples of it) #9287

Answered by me-no-dev
danalvarez asked this question in Q&A
Discussion options

You must be logged in to vote

it's best to use a FreeRTOS task and delay inside. You can have a few to do the different delays, or do it inside with counting the multiples of 100ms.

void myCoolTask(void * arg){
  while(1){
    // do your thing
    delay(100);
  }
}

void setup(){
  xTaskCreate(myCoolTask, "myCoolTask", 4096, NULL, 2, NULL);
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@danalvarez
Comment options

@me-no-dev
Comment options

Answer selected by danalvarez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants