Custom Servo library

Last night I wrote up a wrapper for I2C communication with our 2 RMCS-2203 servos. We also set up a github repository which will host and version-control all of our code. I also put our electronics schematics in there. Here’s a link to the repository so you can peek at what I’ve written: https://github.com/wincelet/tuftsrobotics_icc2015

My library appears in the “main_sketch” folder and consists of the RMCS2203.h and .cpp files.

I’m pretty proud of the library. It allows you to set and get every parameter described in the I2C section of the datasheet (which I’ve hosted here: https://drive.google.com/file/d/0Bzfnuj4LxfQ9VGFNV2k5dnhTNTQ/view?usp=sharing)

You create the RMCS2203 object like so:

RMCS2203 myMotor;

And in setup() you attach the motor to a particular I2C address:

myMotor.attach(0x10);

Then you should probably set the servo’s control system to default gains, since these can get set improperly when powering off the motors:

myMotor.defaultGains();

Simple as that. I have yet to write any code to move the smaller servo, but I should most likely be able to use the Servo library packaged with the Arduino IDE, so there’s not much work to do there.