CAN Bus programming?

Hello everyone, this year team 5709 is planning on have 12 motors in total. Mainly bag motors. So power isn’t a problem. I was wondering if it is possible to program 10 using PWM ports and then 2 using can. If so is the code for the CAN Bus any different from PWM? Is there a tutorial or article I can read some where about this? If not how do I program java to run all 12 in a CAN Bus?
Thank you for your time!

You must use a motor controller which supports CAN and the appropriate class. Other than that, everything is abstracted pretty much the same. I recommend reading the documentation for the CAN based controller you will be using.

There’s many different ways to get more ports for motor controllers, do you have motor controllers that support CAN? These would be either the new Victor SPX or a Talon SRX.

If not, the cheapest solution may be to buy a MoreBoard from RevRobotics, that’ll give you a few more PWM sports. You can also use Y splitters on your drivetrain sides, if you’re that tight in ports, there might even be some in the KoP. The code for a basic -1…1 isn’t that different, it’s the hardware that’s different.

I’d suggest seeing what motor controllers and wires your team has from the KoP and what your budget is and then go from there. The software side won’t experience much difference.