simple events.pde code:

I'm working towards a UAV plane drop from a weather balloon near 100k ft, and trying to use the events.pde file to pull the release pin based on altitude.  Since I'm pretty new to arduino, I'm starting simple.  Trying to make the rudder kick over to -45 after 30 seconds, so I put this snippet in the bottom of the events.pde file.  Compiler doesn't like elapseTime or servo_out.  Is that because those variables are not used anymore?  Because I stole the snippet from this post?

Thanks!

// called after every single control loop
void mainLoop_event(void)
{
        if(elapsedTime > 30000){ // 30sec
                servo_out[CH_RUDDER] = -45;
           }
}

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • I'm getting closer.  I see that I should use a servo command like the one below.  Now I just need some advice on the best place to call it from the main arduplane code.  I currently call "event_rudderkick();" at the top of the navigate() function.  Later I will change it from a rudderkick to something that will pull the egg drop pin based on altitude.  

    Any idea why the rudder only goes to -45 for a brief moment?  I tried to use the delay command.

    // called when entering navigation
    void event_rudderkick(void)
    {
           g.channel_rudder.servo_out = -45;
           APM_RC.OutputCh(CH_4, g.channel_rudder.servo_out); // send to Servos
           delay(10000);
    }

This reply was deleted.

Activity