Ping sensor question

Hey guys, I have a quick question.

My robot Ive built is runninh great with the exception

that it tends to run into walls.

My code states > 40 then do such and such.

Should I increase or decrease. It will drive

into wall. stop then scan then turn around 

and in most case drive into the next wall.

What software are you using?

Dear: Jmaderer

First of all I have no idea what the number > 40 means but here is how you use a ping with arduino.

From: Noah

ping
I have had very random results with the cheap HC-SR04 sonar modules. They were particularly terrible when moving (either robot or target). Typical result was no echo.

hey guys

Thank you for the input. I have toyed with the distance.

I am thinking you are right about the sensor being cheap

and also semi.working. It does work but it seems

some pings maybe are absorbed or rather not picked up.proper.

Possiblly maybe double echos . I think I may add the ir and see what results I get. Thanks again guys. This forum is 

full of helpful people