Quantcast
Channel: Intel Communities: Message List
Viewing all articles
Browse latest Browse all 19055

Re: HC-SR04 Sketch

$
0
0

sorry i'm still new to this..

 

are you referring that i should put both the digitalwrite for the trigPinLeft and trigPinRight on the same function like as bellow. It still does not work with as bellow. With the bellow one now i have nothing at all.   

mind to share you code that has 2 UltraSonic attach to it so that i can used yours as sample.

 

void pingUltra()

{

  digitalWrite(trigPinLeft, LOW);

  digitalWrite(trigPinRight, LOW);

  delayMicroseconds(2);

  digitalWrite(trigPinLeft, HIGH);

  digitalWrite(trigPinRight, HIGH);

  delayMicroseconds(10);

  digitalWrite(trigPinLeft, LOW);

  digitalWrite(trigPinRight, LOW);

// NOT checking for LOW. it seemed to hang here if i used it.

  pstart=micros();

  while(digitalRead(echoPinLeft)==HIGH){}

  pstop=micros();

  pstart2=micros();

  while(digitalRead(echoPinLeft)==HIGH){}

  pstop2=micros();

iLeft = (pstop-pstart)/29/2; //testing only

iRight = (pstop2-pstart2)/29/2; //testing only

}


Viewing all articles
Browse latest Browse all 19055

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>