Source Code for "Robot Builder's Bonanza" Third Edition

by Gordon McComb and Myke Predko

The latest incarnation of Robot Builder's Bonanza includes the different Parallax BASIC Stamp 2 applications listed below. The single micrcontroller was chosen for its relative ease and low cost (remember to use the coupon at the back of the book to order from to set up a development lab complete with a programmer to help you develop your own applications like the one below.

To download and install the Parallax PBASIC Windows Editor, go to the parallax web site ( and click on "Downloads".

Rather than copy each file individually onto your PC's harddrive, it is recommended that you download the .zipped up copy of the source code directories by clicking here and storing the folders and files on your hard drive.

BS2 Template.bs2 BS2 Application Template - Enables PBASIC 2.5

Chapter 11 - Hacking Toys

BS2 Robot Move.bs2 Commanding a hacked toy robot to move

Chapter 15 - The BASIC Stamp 2 Microcontroller

BS2 Hello World.bs2 First Application - Print a friendly greeting
LED Flash 1.bs2 Flash a Single LED accessing the I/O Pin as Variables
LED Flash 2.bs2 Flash a Single LED accessing the I/O Pin using the PBASIC "Low" and "High" functions
LED Flash 3.bs2 Flash a Single LED by "Toggling" the I/O Pin
Cylon Eye.bs2 turn one LED on in an array and move it back and forth
Button 1.bs2 Control the operation of an LED using a button
Button 2.bs2 Debounce a button input
BS2 LCD.bs2 Control an LED's Output using the BS2
BS2 Port IO.bs2 Simulate and control the operation of the BS2's I/O Port Pins

Chapter 16 - Remote Control Systems

BS2 Teaching Pendant.bs2 Joystick Teaching Pendant for Robots
BS2 Remote Control.bs2 Decode Sony Remote Control Signals and Display on an LCD

Chapter 20 - Working with DC Motors

BS2 PWM.bs2 Varying LED brightness using Pulse Wave Modulation

Chapter 22 - Working with Servo Motors

Calibrate.bs2 Simple Program to Calibrate (find the stop point of) Servos modified for continuous rotation

Chapter 30 - Object Detection

BS2 Object Detection.bs2 Detect objects using an IR LED and TV Remote Control Receiver
BS2 Object Ranging.bs2 Rough determination of object distance from IR LED and TV Remote Control Receiver
BS2 GP2D12.bs2 Object distance determination using Shart GP2D12
Piezo Contact Detection.bs2 Detecting contact with an object using a piezo sensor

Chapter 30 - Object Detection

BS2 ISD2532.bs2 Recording and playing sound using the ISD2532 digital sound recorder chip

Chapter 33 - Navigation

BS2 Line Follow.bs2 Robot line following application
BS2 Wall Following.bs2 Robot wall following application
BS2 Polaroid 6500.bs2 Measuring distance to object using Polaroid 6500

Chapter 35 - Experimenting with Tilt and Gravity Sensors

BS2 ADXL202.bs2 Displaying tilt using an ADXL202