The car walks along the black line

 

 

principle

Based on the black outer border:

(White: 70, Black: 8) 60 is a little smaller than white detected, a little bigger than black

When white is detected, the car body will deflect in the direction of black;

When black is detected, the car deflects in the direction of white.

So it doesn't walk in a straight line, it moves slightly to the left or right.

Notice

In the program, the judged value should be slightly larger or smaller. For example, white is 60, then the judgment value can be set to 50 

The infrared sensor should be installed as low as possible

 

 

Guess you like

Origin blog.csdn.net/weixin_72634509/article/details/130434634
car