Suspend Main Loop

czuvich
Posts: 36
Joined: Tue Sep 04, 2018 1:58 am

Suspend Main Loop

Postby czuvich » Wed Feb 27, 2019 2:32 pm

Is there a way to suspend the loop() completely? I will be using tasks and timers to run my Arduino code.

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Suspend Main Loop

Postby ESP_igrr » Wed Feb 27, 2019 2:46 pm

Since loop is a FreeRTOS task, possibly by killing it with vTaskDelete(NULL). Or if you want to resume it later, you can block on any FreeRTOS synchronization primitive with portMAX_DELAY as timeout. You can use queue, semaphore, task notification, etc for this.

chegewara
Posts: 2364
Joined: Wed Jun 14, 2017 9:00 pm

Re: Suspend Main Loop

Postby chegewara » Wed Feb 27, 2019 7:30 pm

Yes, it is possible. You can even do it from setup(), just call vTaskDelete(NULL)

Who is online

Users browsing this forum: Google [Bot] and 59 guests