ULTRASONIC SENSOR NOT WORKING

I’m making a robot for school program, I am new to robotics so I’ve decided to use a code from the internet. Unfortunate the robot is only going forward, while it’s supposed to avoid obstacles, using the distance sensor.

Schematics: Cheap Arduino robot schematic_bb.jpg - Google Drive

and the code:

I’ve tried editing the pins for the ultrasonic sensor to see if it will work, just in case if you are wondering why the pins are connected to 0 and 1 (it is 2 and 3 in the code).

And some pictures:
Imgur
Imgur

The wires on the left are positive and negative, because I am using a smaller breadboard.

Those photos are a waste of time as you can see nothing of interest.

Please post your code here and attach the schematics to your post to avoid the need for them to be downloaded.

Hi,
Are you using pins 1 and 2?
Avoid using 0 and 1, as they are the program/monitor comms pins.

Tom… :slight_smile:
If you use REPLY rather than QUICK REPLY you will see an ATTACHMENT facility, it makes life so much easier if you attach than link files.

Have you tried running the sensor alone as a project using the example code? It pays to check your hardware first. Assuming it works or not is a great way to mix up problem sources.