Dear Robotics Community,

I am participating in a Robotics tourney that will start in a few weeks. The challenge I signed up for is to deliver and dump ping pong balls to a box. I already have my robot and the ball container built, but I need some help with coding it.

I just need help coding an SR04 ultrasonic sensor for my Arduino robot. I want it so that when it senses the box in front of it, the robot turns on a motor and stops when the box is a certain distance away from the robot. I also want it to back up and go back to its starting position when it is done delivering the payload. I was told by my coach that a "boolean variable" would do the job, but I also do not know how to program this.

Thank you!

(Here is the robot platform I am using: https://www.elegoo.com/product/elegoo-uno-project-smart-robot-car-kit-v1-0/)


1 Answer 1


Did you try the newPing library ?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.