Jump to content
43oh

PWM C++ class for the BeagleBone


Recommended Posts

Again, from the quadrotor diaries - A simple c++ class for the PWM sub-system. The A8 on the beaglebone has three pwm blocks with 2 pwm outputs each. The code encapsulates one block for two PWMs, bringing the total to 6 PWMs.

Github link.

Usage:

#include "cPWM.h"

cPWM::cPWM* pwmout;

main()
{
//the 2 is because we're gonna use eHRPWM2
pwmout = new cPWM::cPWM(2);
//Period in ns. 20000000ns = 20ms
pwmout->Period(20000000);
//DutyA sets the duty for eHRPWMnA to 1ms
pwmout->DutyA(1000000);
//go eHRPWM2A !!!
pwmout->RunA();
return 0;
}
Link to post
Share on other sites

@@bluehash Maybe we should have a links post like on 43oh ? I was thinking about that already this morning. BUt maybe you should make it so you could sticky it too ?

Links as in? Sorry I don't understand.

 

Edit: you mean helpful links? Looks like you started it. I can sticky it up.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...