Cover by Michael Margolis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

Appendix B. Using Other Hardware with Your Robot

You may want to add more capability to your robot or perhaps substitute different hardware than the items covered in the text. This chapter describes how to use some common alternative components.

Alternative Motor Controllers

Ardumoto

This popular H-bridge can be used instead of the Adafruit shield described in the text if you have a two wheeled robot (the shield only supports two motors). It also lacks the convenient layout for the analog sensors and you will need to add two 3 pin headers for the servo and distance sensor connections. The Motor code for Ardumoto is shown in Example B-1.

Continuous Rotation Servos

Continuous rotation servos are hobby servos modified to rotate continuously with a speed and rotation direction controlled by the Servo library that comes with Arduino. The servo rotates in one direction as the angle written to the servo is increased from 90 degrees; it rotates in the other direction when the angle is decreased from 90 degrees. The actual direction forward or backward depends on how you have the servos attached. Continuous rotation servos may not stop rotating when writing exactly 90 degrees. Some servos have a small potentiometer you can trim to adjust for this, or you can add or subtract a few degrees to the motorStopAngle element to stop the servo. This version uses digital pins 7 and 8 but you can change this by altering the elements of the servoPins array (the first element for all the arrays is the left ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required