Hello all. I am building an Arduino rover and am having a hard time getting the sonar to work. I ended up redoing the code about ten times and then deleting it in rage. I figured it was time to get professional help.
I need help making a function titled "scan" that uses my 4 pin ultrasonic sensor and returns the distance as an integer (Yes, I know I loose accuracy doing that, but I do not need decimals)? I need to know what goes before the setup in the code (what do I need to declare?), and what goes in the actual function at the bottom of the loop.
Thank you for the help