On this page we will look at the Mindstorms NXT programming environment and post instructions/ideas and programming solutions that the pupils have developed to create certain behaviours.
Behaviours Developed by Pupils
Follow a black line using one light sensor:
The idea is that the robot follows one edge of the black line. The robot has two motors, one driving the left wheel and one driving the right. It moves towards the line. As the sensor reaches the line it detects the black. The light sensor program turns off one motor and turns on the other. This takes the robot back off the black line. This runs for enough time to take it clear of the line. Then the second motor is turned off and the first one is turned back on. This brings the robot back to the black line. When the light sensor senses the black line the program starts again. In this way the robot edges along the black line in a zig-zag motion.
Programming details and diagrams to follow.
Follow a black line using two light sensors:
This works in much the same way as the above program except that there are two light sensors, one at each side of the black line. Each light sensor, (when it detects the black line), turns off the motor on its own side and turns on the motor on the opposite side.
More about these ones later ……
- Looping a program to repeat behaviour.
- Robot shows fear of the dark.
- Robot following a wall.
- Open a door.