Spread the sheet for line trace on the floor.
First, you must first check the characteristics of the light sensor.
Select the menu "View", select the "Reflected light" → "Port3".
The red LED light will illuminate the range of about 1.5cm in diameter. The light sensor reads the value from the middle of the "white" and "black" light of the floor. Since we will use this sensor value later, please remember.
The distance between the light sensor and floor is the best for about 1cm.
Please note if the sheet is not flat as shown in the picture, the value of the sensor would change a few percent.
This is introduced in the "robot educator", is probably the simplest program. I made a program using the NXT software.
It was named unit. 1.
This program, using the "switch block ", the value of the light sensor is branched to "white" or "black".
[Download] Line tracer unit 1
(Created in NXT software for education 2.0)
This is a movie when the program is running.
[Movie] running of Unit 1movie (youtube)
Robot is moving in a zigzag if you look closely
Why is this?
Looks like this: When you figure the movement of the line tracing robot.
The blue arrow is the movement of the motor C,
The red arrow is the movement of the motor B.
Robot is moving alternately the motor B and C, while looking for a break on the line. This is the reason the robot goes to zigzag movement.
The switch block, enter the sensor values were measured before "middle of the white and black."
In my case, it was "42" in the middle, I entered "42".
It will be called "position neither white nor black ".