SmallBot
reconn's
reconn's
world
world
.com



introduction | platform | motors | batteries | third 'wheel' | second level
computer | sensors | interfacing | programming | parts & suppliers

[an error occurred while processing this directive] smallbotprograms



it's alive - IT'S ALIVE!!! MWOOOHAHAHAHAHAHA!!

Whoops! I'm getting a little carried away here.. If you came to this page in search of Basic Stamp II code for the SmallBot, you're in luck - that's exactly what this page is for! Click on the links below to go directly to each program.

Note about the Random Behavior code. This BS2 code was rewritten by me, to update the BS1 code that comes in the book Programming and Customizing the Basic Stamp Computer (Tab Books - $31.46). You will need to run this code on the BS2, and not the code supplied with the book.

Current Programs:
- Getting to know your servo motors.
- How do I get that cool Sonar to work for me?
- Random Behavior (no sensors needed)
- Random Behavior w/ Sonar (using a ultrasonic sensor)


Getting to know your servo motors. back to top...

In order to run servo motors via the basic stamp, you will need to know how big a millisecond pulse to send to the motor. If you used a potentiometer when you hacked your servos, run the code as-is, and adjust the potentiometer until the motors stop completely. If you used 2 resistors (I used 2 2.4k resistors,) change the value (150) until the motors stop motion when the program is run. For information on how to hook up the motors, visit the Interfacing Smallbot page.

To obtain the source code, follow one of the two links below. One is a text file, the other is a BS2 compiler document,

knowyourservos.txt
OR
knowyourservos.bs2

How do I get that cool Sonar to work for me?? back to top...

This program sends a burst of ultrasonic sound, and listens for it. If it gets bounced back to the sensor, the goes to the function 'hurt' if it doesn't get back to the sensor, it goes to the function 'run.' you should call function 'sonar' as a subroutine, maybe between motor pulses.

To obtain the source code, follow one of the two links below. One is a text file, the other is a BS2 compiler document,

sonar.txt
OR
sonar.bs2

Random Behavior back to top...

This program gives the SmallBot motion. This program consists of 4 orders, go forward, turn left, turn right, and stop - picked psuedo randomly. Make sure that you adjust all variables correctly. For information on how to hook up the motors, visit the Interfacing Smallbot page.

To obtain the source code, follow one of the two links below. One is a text file, the other is a BS2 compiler document,

randombehavior.txt
OR
randombehavior.bs2

Random Behavior w/ Sonar back to top...

This program adds a little spin on the Random Behavior program. In addition to the random movements, this program receives feedback from the sonar. When an obstacle is detected using the sonar, the SmallBot backs up, and turns randomly left or right.

To obtain the source code, follow one of the two links below. One is a text file, the other is a BS2 compiler document,

randomsonar.txt
OR
randomsonar.bs2


introduction | platform | motors | batteries | third 'wheel' | second level
computer | sensors | interfacing | programming | parts & suppliers




Site by Andrew Wilson. Copyright 1997-2006 All Rights Reserved unless otherwise noted.
Schematics in Schematics Depot were found on the internet and assumed to be in public domain. Contact webmaster if the copyright holder wants them pulled for any reason.