Programming for kids : a simple lego robot

video | build instructions | programming
<

The video

Build instructions

This robot has been built with pieces from the lego we do set plus some other pieces.





Programming

To program the robot we use the open source software Scratch. Here is the distance sensor:
When an obstacle is close to the sensor it returns the value 0. When the obstacle is more than 6 inches the sensors returns 100. Otherwise a number between 0 and 100 is returned, corrsponding the the distance with the obstacle. You can read the value of the sensor using the following construct in scratch: .
To start the engine in a direction use: . You can change the direction with . This gives the following code for the robot: