ESP32 Task

KrisRevi
Posts: 6
Joined: Sun Mar 29, 2020 12:28 pm

ESP32 Task

Postby KrisRevi » Sun Mar 29, 2020 12:34 pm

i found this -> https://learn.sparkfun.com/tutorials/li ... isplay/all and i uploaded it to my ESP32 and it worked! great... now when i also put in my code for controlling my LED's and put that inside the void loop() the spotify script stops going / working!

the sparkfun script uses Task:

Code: Select all

xTaskCreatePinnedToCore(
             Task1code, /* Task function. */
             "Task1",   /* name of task. */
             10000,     /* Stack size of task */
             NULL,      /* parameter of the task */
             0,         /* priority of the task */
             &Task1,    /* Task handle to keep track of created task */
             0);        /* pin task to core 0 */
i've never worked with Tasks on an ESP32 "TaskCreatePinnedToCore" how can this be fixed to run with my code?

username
Posts: 533
Joined: Thu May 03, 2018 1:18 pm

Re: ESP32 Task

Postby username » Sun Mar 29, 2020 6:51 pm

I would guess that It's probably because loop() has a higher priority than task1.

Task1 has a priority of 0, which is as low as you can go. Thus it will get serviced last if other tasks are consuming CPU resources.

mrburnette
Posts: 22
Joined: Mon Feb 12, 2018 6:50 pm

Re: ESP32 Task

Postby mrburnette » Sun Mar 29, 2020 11:16 pm

I have a forum post that hopefully explains the dualcore programming a bit:

https://www.hackster.io/rayburne/esp32- ... res-8dd948

Ray

Who is online

Users browsing this forum: No registered users and 45 guests