Programming a HC-SR04 distancesensor


i´m building on little robot , include in little project distance sensor(hc-sr04). have problem programm because hc-sr04 isn´t exact. told him make 90° curve if distance under 10 cm. problem hc-sr04 measures 0 cm in real not true. maybe measuring error. how tell robot (i´m using if-function make curve) ignore 0 cm measured hc-sr04? explain me ways how it?
the programm:
if(cm <=10){
 analogwrite(e1,255);
 digitalwrite(m1,low);
 delay(675);
 }
e1 servo.
m1 direction-> backwards
please me!!!

i try use expression:

if (cm <=10 && cm>1) {

....

}



Arduino Forum > Using Arduino > Programming Questions > Programming a HC-SR04 distancesensor


arduino

Comments

Popular posts from this blog

DHT11 Time out error using v0.4.1library

Sketch upload fails with Java error (___REMOVE___/bin/avrdude)!

Arduino Uno + KTY81/210 temperature sensor