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


#1

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


#2

Similar like this:
image


#3

Thanks


#4

:grinning:My pleasure


#5

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