#include <Arduino_FreeRTOS.h> #include <task.h> void vApplicationTickHook(void) { // This function is called by FreeRTOS on every tick interrupt // You can implement custom behavior here if needed } void vApplicationIdleHook(void) { // This function is called by FreeRTOS when the scheduler is idle // You can implement custom behavior here if needed } void task1(void *pvParameters) { while (1) { Serial.println("Nirma"); vTaskDelay(100); } } void task2(void *pvParameters) { while (1) { Serial.println("University"); vTaskDelay(200); } } void setup() { Serial.begin(9600); xTaskCreate(task1, "Task1", 50, NULL, 2, NULL); xTaskCreate(task2, "Task 2", 50, NULL, 1, NULL); vTaskStartScheduler(); } void loop() {}
#include <Arduino_FreeRTOS.h> #include <task.h> void vApplicationTickHook(void) { // This function is called by FreeRTOS on every tick interrupt // You can implement custom behavior here if needed } void vApplicationIdleHook(void) { // This function is called by FreeRTOS when the scheduler is idle // You can implement custom behavior here if needed } void task1(void *pvParameters) { pinMode(8, OUTPUT); while(1) { digitalWrite(8, HIGH); delay(1000); digitalWrite(8, LOW); delay(1000); } } void task2(void *pvParameters) { pinMode(9, OUTPUT); int brightness = 0; while(1) { analogWrite(9, brightness); brightness++; if (brightness > 255) { brightness = 0; } delay(50); } }