Rev spark cpp api examples

Team 701 is trying to use some new rev spark motor controllers. We are looking for examples of how to use them in c++. We couldn’t find examples anywhere so that’s why we’re here, if we could get some examples of how to set up the controllers that would help us out a lot.

The Spark Max API in C++ seems pretty similar to Java. You’d include the motor controller object (CANSparkMax) and the object containing types (LowLevelSparkMax) to define it. You just instantiate a motor controller and specify port, followed by the motor type from LowLevelSparkMax. This is pretty similar to any other FRC motor controller, except for control type. if you’re using a NEO, it’s kBrushless, anything else is kBrushed.

Though it’s likely not that helpful, here’s some test code we were using in java today. On the off-chance you didn’t see it, the Spark Max C++ API docs are here.

We’ve put together some examples, they are all available here https://github.com/REVrobotics/SPARK-MAX-Examples

Thanks a lot. This really helped us out.