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

Re: HC-SR04 Sketch

$
0
0

You should do one at a time. In your code, you tried to trigger both left and right, and then read left twise.

Also from what I remember there are just two fast pins on galileo so make sure to connect the two echo pins to that

Here is what i'd try

 

 

 

void pingUltra()

{

//----------do the left

digitalWrite(trigPinLeft, LOW);

delayMicroseconds(2);

  digitalWrite(trigPinLeft, HIGH);

  delayMicroseconds(10);

  digitalWrite(trigPinLeft, LOW);

pstart=micros();

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

  pstop=micros();

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


//-----------now do the right same as above - change variables as needed



}


Viewing all articles
Browse latest Browse all 18672

Trending Articles



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