How do I program the ultrasonic sensor to follow the object infront?


I am new to robot coding but my objective is to make mBot’s sensor follow the object in front instead of avoiding it.


Similar like this:




:grinning:My pleasure


also how do i connect this code with the line follower sensor to stop the robot when it detects nothing