Hey everyone,
This is a relatively simple one, but i couldn't find a thread about it. So I'm still getting to know the FreeRTOS abstractions, and I was wondering what I was doing wrong.
Imagine a situation where you wanted to connect to WiFi. Until the connection is established, the onboard led should blink. When the handshake is successfully completed, the led should be always on. However, If i do not manually relinquish control from the task, it will starve the watchdog process and it will not behave in the way i expect it to do. The best I could come up with is to call vTaskDelay() for about 20 milis so i can get the control back to the scheduler, but during this time, the led powers down, so i have a perceptible blink. Is it possible to somehow do "background" tasks, and always keep them active, such as powering a motor, or an LED or a pump whatever, while simultaneously checking for temperature or humidity in regular intervals?
Task management - Keeping a led on constantly
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: Task management - Keeping a led on constantly
You are aware that a GPIO normally keeps its state, as in the normal behaviour is that it stays on once you've set it to be on?
Re: Task management - Keeping a led on constantly
I was not aware of that tnx
Re: Task management - Keeping a led on constantly
I'll reasearch it more, but I think it resets the state when i delay or suspend the task.
Re: Task management - Keeping a led on constantly
You can do one thing like create task initially while starting firmware in which blink LED state as per your requirement and then delete task once you get connectivity. Also change LED state to high as per your requirement.nesicarh wrote: ↑Tue Apr 23, 2019 1:39 pmHey everyone,
This is a relatively simple one, but i couldn't find a thread about it. So I'm still getting to know the FreeRTOS abstractions, and I was wondering what I was doing wrong.
Imagine a situation where you wanted to connect to WiFi. Until the connection is established, the onboard led should blink. When the handshake is successfully completed, the led should be always on. However, If i do not manually relinquish control from the task, it will starve the watchdog process and it will not behave in the way i expect it to do. The best I could come up with is to call vTaskDelay() for about 20 milis so i can get the control back to the scheduler, but during this time, the led powers down, so i have a perceptible blink. Is it possible to somehow do "background" tasks, and always keep them active, such as powering a motor, or an LED or a pump whatever, while simultaneously checking for temperature or humidity in regular intervals?
And once you get disconnect event then again start that LED blink task.
So, I think using that way also you can control LED as per your requirement.
Regards,
Ritesh Prajapati
Ritesh Prajapati
Who is online
Users browsing this forum: dzungpv, Majestic-12 [Bot] and 134 guests