Delay method

Home Forums Drona Aviation Delay method

This topic contains 1 reply, has 2 voices, and was last updated by  prasanna.shevare 1 month ago.

  • Author
    Posts
  • #3974

    Pavan
    Participant

    Hi,

    I want to do something like this in the dev mode:

    1. Give 1200 throttle for 5 seconds
    2. After that, give 1500 throttle for next 5 seconds
    3. Then stop it by giving throllte 1000.

    Is there any way to achive it?

    The following code is not working:
    void plutoPilot()
    {

    Motor.set(M1, 1200);
    delay_ms(5000);
    Motor.set(M1, 1500);delay_ms(5000);
    Motor.set(M1, 1000);

    }

    Thanks,

  • #3984

    prasanna.shevare
    Participant

    Hi Pavan,
    delay_ms(5000) is a blocking function. In order to execute this code properly, you need to use a non-blocking function. I will upload the code here in a couple of hours.

You must be logged in to reply to this topic.