Software PWM
I finally went for a software solution (below) and will now use all six PWM outputs for the motors allowing hexacopters etc.
I must put something up here but the Wiki is at:
http://code.google.com/p/uavp-mods/wiki/UAVXArm
For others the code I used is:
CameraTicker.attach_us(&CamPWMOnISR, 22000);
void CamPWMOnISR(void) { PWMCamRoll.write(1); CamRollTimeout.attach_us(&CamRollPWMOffISR, 1000 + PWM[CamRollC]); PWMCamPitch.write(1); CamPitchTimeout.attach_us(&CamPitchPWMOffISR, 1000 + PWM[CamPitchC]); }
void CamRollPWMOffISR(void) { PWMCamRoll.write(0); CamRollTimeout.detach(); redundant? }
void CamPitchPWMOffISR(void) { PWMCamPitch.write(0); CamPitchTimeout.detach(); redundant? }
Probably could be simpler (do I need the detach or does this just happen after the timeout for example?) but seems to work fine with now visible performance impact on anything else.
Please log in to post comments.