How to change height in height mode

Firmware/software/electronics/mechanics
matthieuleonie
Beginner
Posts: 20
Joined: Mon Nov 13, 2017 11:54 am

Re: How to change height in height mode

Post 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! :)
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: How to change height in height mode

Post 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.
Post Reply