Demo Program in RIS 2.0 code
Go to Home Page


The program below is for collision avoidance with the simple robot shown below. This example is in written in RIS 2.0 code.

The column causes the robot to go forward. It will continue to go forward until the sensor sees something.

The second column runs when the sensor detects an object on it's left side. The right motor is turned off, while the left motor continues to run. This causes the robot to turn to the right. When the sensor no longer sees anything, the fifth column will be activated, causing the robot to go forward again.

The third column works the same as the second column, except the right and left are reversed.

The fourth column is activated when the sensor detects something straight ahead, or on both sides at the same time. In this case the robot backs up, turns to the right, then continues straight ahead.

This is a simplified example. There are corner conditions where the robot will crash into an object. This program can produce interesting results when the sensor detects a smaller object. It is fun to experiment and modify the program.