RTOS w Esp-idf to jest to, co tygryski lubią najbardziej, ale nikt mi nie powie, że Arduino-IDE nie jest fajne? Ani pół include-a i działa :).
//Isn't it cool? void setup() { Serial.begin(115200); delay(1000); xTaskCreate( taskOne, /* Task function. */ "TaskOne", /* String with name of task. */ 2000 , /* Stack size in words. */ NULL, /* Parameter passed as input of the task */ 1, /* Priority of the task. */ NULL); /* Task handle. */ xTaskCreate( taskTwo, /* Task function. */ "TaskTwo", /* String with name of task. */ 2000, /* Stack size in words. */ NULL, /* Parameter passed as input of the task */ 1, /* Priority of the task. */ NULL); /* Task handle. */ } void loop() { delay(1000); } void taskOne( void * parameter ) { for( int i = 0;i<10;i++ ){ Serial.println("Hello from task 1"); delay(1000); } Serial.println("Ending task 1"); vTaskDelete( NULL ); } void taskTwo( void * parameter) { for( int i = 0;i<10;i++ ) { Serial.println("Hello from task 2"); delay(1000); } Serial.println("Ending task 2"); vTaskDelete( NULL ); }
Swoją drogą fajny opis, świetna książka, a ten opis SMP i przeportowanych funkcji RTOS v9 poprostu trzeba przeczytać 😉
Kompletnie nie rozumiem, dlaczego ludzie na Arduino-IDE tak psy wieszają? Dla początkujących jest świetne, geek ugotuje w nim coś na szybko, a SDK nie zając :).