How to change height in height mode

Posts: 20
Joined: Mon Nov 13, 2017 11:54 am

Re: How to change height in height mode

Post by matthieuleonie » Mon Jun 04, 2018 6:24 pm

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! :)

Posts: 1650
Joined: Tue Feb 06, 2007 12:36 pm

Re: How to change height in height mode

Post by arnaud » Mon Jun 11, 2018 2:15 pm

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.

Post Reply