Page 2 of 2

Re: How to change height in height mode

Posted: Mon Jun 04, 2018 6:24 pm
by matthieuleonie
We also have another question : how did you program the Zranger to use it only when the drone need it? I mean, if we use a loop (through while(1)) to constantly read the height, there is a problem with the CPU. So how can we solve this problem?

Thank you for your help! :)

Re: How to change height in height mode

Posted: Mon Jun 11, 2018 2:15 pm
by arnaud
Can I turn the question the other way around? Why do you read the sensor all the time in a while(1) loop without delay? What are you trying to achieve with the data?

Wen we have a while loop we usually chose a rate and stick to it with a vTaskDelay or vTaskDelayUntil (search these function name in the code to find examples), by adding a delay we allow the rest of the system to run.