hcsr04 sensor not sensing on autonomous ground vehicle.

hey guys. i'm struggling here with my project.
the project that i am building is a ground vehicle that can travel autonomously via a hcsr04 ultrasonic sensor.
the motors work fine but the sensor does not seem to be working.

i tested my code here with just the sensor and that seems to work fine but when i attach the sensor to my ground vehicle, it does not work.
also it appears that the trigger is not sending out the signal

here is the code: Wild Thumper Code - Pastebin.com

any help WOULD BE LOVELY!!!!!


Volts=analogRead(Battery); // read the battery voltage
LeftAmps=analogRead(LmotorC); // read left motor current draw
RightAmps=analogRead(RmotorC); // read right motor current draw

Where in your sketch do you declare Battery, LmotorC and RmotorC as analogue inputs pin numbers?
Also read the forum info and you can post your code directly into a post.
Also a diagram of what inputs and outputs are used and even a circuit diagram would be nice. :slight_smile:
It seems like you have started off okay, by developing each area at a time.
It looks like you have done more than just got the motor running and added the sensor. A lot of code to go over.
Have you tried just using sensor to just stop the motors if it detects something first, then work up.

Tom… :slight_smile: