Advertisement
pleasedontcode

FreeRTOS example

Sep 15th, 2024
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Arduino 0.43 KB | Source Code | 0 0
  1. void task1(void * parameter) {
  2.     for(;;) {
  3.         // Task 1 code
  4.         vTaskDelay(1000 / portTICK_PERIOD_MS);
  5.     }
  6. }
  7.  
  8. void task2(void * parameter) {
  9.     for(;;) {
  10.         // Task 2 code
  11.         vTaskDelay(500 / portTICK_PERIOD_MS);
  12.     }
  13. }
  14.  
  15. void setup() {
  16.     xTaskCreate(task1, "Task 1", 1000, NULL, 1, NULL);
  17.     xTaskCreate(task2, "Task 2", 1000, NULL, 1, NULL);
  18. }
  19.  
  20. void loop() {
  21.     // No code needed here
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement