Moderator

Drop zone toys (manipulating servos via APM)

3689454724?profile=originalSo, over the Easter weekend I had some time in the lab and threw together a crude repeating egg dropper for the quad. Of course, keeping me in line and the cops at bay, the other half talked me out of my nefarious plan to deliver raw, yolked goodies from above and instead had me whip up a tennis ball dropper to entertain the dog.

I've seen a lot of questions about manipulating servos with APM to either click the shutter on a camera or squeeze an airsoft trigger, so here's my approach using the USERHOOKS available in AC2.

Really simply, add the following code to UserCode.pde :

void userhook_init()
{
         APM_RC.enable_out(CH_7);  //Initialize CH_7 port for output
}

void userhook_50Hz()
{
         APM_RC.OutputCh(CH_7, APM_RC.InputCh(CH_6));  //Take input from CH_6 and output to CH_7
}

 

I think the comments make this pretty self explanatory. Monitor input CH_6 at 50Hz (50Hz is probably not necessary, but that function is already defined active in APM_Config.pde) and send that PWM straight out to output CH_7. After adjusting the endpoints on the radio to suit the required throws of the hardware, it was straight egg/tennis ball dropping fun!Be good.

E-mail me when people leave their comments –

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

Join diydrones