Site map :

Various stuff
Rotation sensor
Security device
The Robot pages
Lego Ants
Robotarm v1.0
Robotarm v3.0
Tutorial 1
Tutorial 2
Physics of Lego
Measuring strength
Combining motors
Stepper motors
Lego ratchet
Electronic ratchet
1-to-2 multiplexor
2-to-7 multiplexor
RCX Mindstorms
Survey of RCX programming
The famous machines
Turing machine
New Page 1
References and links

Last upgrade to the site:
august 10th, 2002.

There has been 

access to my Lego pages since creation.

This is an unofficial LEGOŽ web site.
LEGOŽ is a trademark of the LEGOŽ Group of companies which does not sponsor, authorize or endorse this site.
You can visit the official LEGO website at: http://www.lego.com

Copyright 1996, 2000, Denis Cousineau



So far, three projects have been completed.
Project 1: A keyboard interface to control your robot from the PC.
Project 2: A general-purpose program that collect information from a sensor and plot the results after the datalog has been filled.
Project 3: A robot that maps your room, and send the coordinates to the PC that will in turn draw the map!

Project 1:

This project's main purpose is to create an home-made control panel that send orders to the RCX.  Other softwares (such as RCXCC and BrickCommand) have a built-in control panel but this panel cannot be adapted to your own need.  Further, in Project 1, the control panel is program both in Visual Basic and in QBasic.  The programming language you use is irrelevant for PRO-BOT.

wpe18.gif (2705 bytes)

The VBasic interface, working with the keyboard.

wpe1a.gif (4714 bytes)

The same program inside of QBasic.

The program works using a TimeOut section, executed every 100 ms.  This sections sends commands (numbers from 1 to 5) to the RCX which reacts accordingly:

  returned "up"
    setvar(VAR1, CONSTANT, 1)
  returned "right"
    setvar(VAR1, CONSTANT, 2)
  returned "left"
    setvar(VAR1, CONSTANT, 3)
  returned "down"
    setvar(VAR1, CONSTANT, 4)
  returned "stop"
    setvar(VAR1, CONSTANT, 5)
  returned "-1"
    cleartimeout()  {interrupt the timeout section}
    off(02)         {stop all motors              }
    msgbox("Program terminated.")
  returned end

To download all the versions of this program, along with the source code for the Visual Basic executable, get the sample files in the Download section of the PRO-BOT home page, and look for project 1 in the My project subdirectory.

Project 2:

This program is a general-purpose datalog collectors: it sets the RCX to collect data at given interval, for any size of the datalog.  When the datalog is full, it is automatically retrieve by PRO-BOT 2000 which then calls DatalogGrapher for a plot of your data.

wpe1c.gif (6180 bytes)

Here is the result when I measured the luminosity in my room.  Starting at 11 pm., it is mostly dark until 7h30 am.  There are 60 measures per hour, for a total of 1440 entry in the datalog. The few square peaks by the end correspond to the lights I open in my room.  As seen, they are far from being as luminous as the sun.

The datalog is retrieved automatically by spying the PRO-BOT.  When it raises a flag (variable 0 changes value), the following section is called using the command:

declare DATALOGSIZE CONSTANT 1440  {size of datalog=1 per minute for one day}
SetEvent(FLAG, 100)
The following event retrieves the datalog all in one swoop and start the grapher:
  UploadDatalog(1,DATALOGSIZE)  >> "datalog.dat"


To retrieve this program, first, get the sample files in the Download section of the PRO-BOT home page, and look for project 2 in the My project subdirectory.


Project 3:

This is the most elaborate example so far.  The program before compilation is broken in four files of 2 pages each. Yet,  the compiled version requires only 155 bytes of memory! leaving space for a huge datalog of 5900 bytes. Enough to map my whole house.

The general idea is that the robot must find a wall, then follow it endlessly, taking notes of every turns it has to make to stay close to a wall.  Three sensors are needed: one bumper on the left front corner, one on the right front corner, and one sensor connected to the side bumpers.  With the front sensors, the robot knows when it has touched a wall, and hereafter, when it arrives in a corner.

The robot's programs are composed of 3 tasks, 3 subs and a huge datalog. The main task tries to locate a wall anywhere in front of it.  The second task keeps the side bumper pressed while negotiating turns. The last raises the flag to call attention of the PC.

wpe1e.gif (4659 bytes)

This is my room, a little distorted though, after one turn. We can see that my room is far from rectangular, due to the presence of two bump on the opposite corner.  The horizontal line in the middle represents the initial position of the RCX where it started locating a wall. The door (on the lower left side) is closed...

The RCX program and the draw map executable (along with source code for VBasic) are available when you get the sample files in the Download section of the PRO-BOT home page; look for project 3 in the My project subdirectory.