Line follower

need to change the program to follow a white line with black background
I am trying to understand the example site

I understand that white is 0 and 1000 is black
I understand he already goes to 800 to 1
so with 5 sensors 5X800 = 4000 What do was understood
to be in the middle it should mark sensor 3 = 2400 (1000-3000)
if trigger sensor 1 = 800 = 1600 or 2 he is right (0-1000)
and above 4 3200 he left this

in the case of black’ll have him right in the middle sensor 3 0 in the other 800 be in vain not know how to put it in the program

which the value for it to be in the middle (1, 2, 4 and 5) are in black and white in the 3?
could help me with a simple little program to read the sensor and display the value on the display


The read_line_white function can be used to have the 3pi follow a white line on a black background. You should be able to use the example code with minor adjustments, such as replacing the read_line command with read_line_white.

Also, it sounds like you are a little confused about some of the properties of the sensors. The estimate returned by the read_line command is made using a weighted average of the sensor indices multiplied by 1000 (not 800), so that a value of 0 indicates that the line is directly below sensor 0, a value of 1000 indicates that the line is directly below sensor 1, 2000 indicates the line is directly below sensor 2, and so on. Your middle sensor should be sensor 2 (since the first sensor is labeled sensor 0), so a value of 2000 means that the line is directly under your middle sensor.