Using two ultrasonic sensors together, how can I enable one before the other?
-
Do you have a circuit? Any code?Dave X– Dave X2016年05月12日 16:40:28 +00:00Commented May 12, 2016 at 16:40
1 Answer 1
You need to tell the sensor to send their pulse using the trigger line. So triggering isn't a problem. The problem is that you might get an echo returned on both sensors, but you know which sensor sent the pulse so you can ignore the return that was received by the 'wrong' sensor in your code. So
While(1)
{
SendPulse(SensorTx1);
GetEcho(SensorRx1);
SendPulse(SensorTx2);
GetEcho(SensorRx2);
}
Is that what you mean? If not please can you expand you question?