Saturday, January 3, 2015

Arduino Seeed Studio Motor Shield Library

So, first post in a long, long time. A little over a month ago I was given a Motor Shield V1.0 designed by Seeed Studio for the Arduino Uno. Today, using LEGOs from an old NXT set, I designed a "car" that neatly fit to the Arduino and motor shield. The car is driven directly by two independent gear-reduced motors on the back wheels. At this point I downloaded the example code written by Seeed Studio and was appalled to find that rather than a library supplying simple motor forward / motor back commands, the code was a group of functions to copy and paste to other sketches. I searched around and managed to find... Nothing. Nobody had written a library to control the motor shield, so I decided I would write one. This is my first Arduino library (and first library in general), but I think it turned out pretty well. It has forward, backward, left, right, timed forward, timed backward, timed left, timed right, and the ability to change the speed of the two motors.

If you want to use it in a project of your own, you can download it here:

https://drive.google.com/file/d/0BxlYH0Xw3QsBWkM4RzZVNkFqaEE/view?usp=sharing

The syntax and use is pretty well documented in the example sketch I've included. Comments, suggestions for future projects with Arduino, and suggestions on improvements to my code are greatly appreciated. Thanks!

2 comments:

  1. looking for a custom arduino library based on the isl1208, someone said you were the guy to talk to?

    ReplyDelete
    Replies
    1. Hey Lou, yeah I am the right guy. I've been working on another library for a while and have been running into a bunch of problems with internal clocks conflicting over interrupt timing I think. I want to put it on the shelf for a while and come back to it with fresh eyes eventually. I'd be grateful for another project to work on in the meantime. I haven't really worked with I2C much other than altering other people's pre-made libraries, so this'll be a good learning experience. Check your email for more info.

      Delete