[Q2].Sonar跟超音波應該是一樣的通西八?? 是因為統稱嗎?! 因為爬文看有些人也是叫超音波為聲納!! 看這顆超音波的 data sheet 也是一樣是用sonar 這個字彙.
[Q3].這顆是打出去的超音波一邊打出去 一邊接收嗎?!! 還是兩顆一起打 兩顆一起收!!?
[Theory of Operation].(想請問我這樣解讀這顆超音波的動作原理對嗎?!)
‧一開始給予一個(high-low-high)的觸發信號,再等待750mus啟動Sonar產生頻率40kHz的聲音 振盪200us ,此時Sonar會以High的Pulse來量測回傳的Pulse,即Sonar的距離。 "動作原理的圖 在page of 13"
不過得看你是用怎樣的方式接她喔
我是接在arduino上面使用的
控制他只要這樣寫就可以哩
int pingPin = 7;
void setup()
{
Serial.begin(9600);
}
void loop()
{
long duration, cm;
// The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
// We give a short LOW pulse beforehand to ensure a clean HIGH pulse.
pinMode(pingPin, OUTPUT);
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(5);
digitalWrite(pingPin, LOW);
// The same pin is used to read the signal from the PING))): a HIGH
// pulse whose duration is the time (in microseconds) from the sending
// of the ping to the reception of its echo off of an object.
pinMode(pingPin, INPUT);
duration = pulseIn(pingPin, HIGH);
// convert the time into a distance
cm = microsecondsToCentimeters(duration);
long microsecondsToCentimeters(long microseconds)
{
// The speed of sound is 340 m/s or 29 microseconds per centimeter.
// The ping travels out and back, so to find the distance of the
// object we take half of the distance travelled.
return microseconds / 29 / 2;
}作者: mzw2008 時間: 2009-12-4 15:36
程式碼很容易改
應該也不難看懂