One of these little devices here is sending out a ping, or
a sound, in this case at 40 kilohertz, and the other devices is taking it in.
The other side of the device is taking it in.
So considering we're using the trigger as a write device,
we're writing onto the device, and
the echo to read, then when we send a signal to the device,
it shoots out the ping, when the echo comes back we read it into the board.
>> A nice little example I like to think of is pretend you have a ball and
you kinda wanna compute the distance to the other wall,
so what you do is you take the ball and you throw it against the other wall.
And now you're going to have your arms open and waiting for
the ball to come back, and when the ball bounces off the wall then you grab it.
Then you say, oh it took ten seconds for me to get the ball back from
when I first threw it, so then from if you know the speed that you threw it at,
let's say ten miles per hour, or something like that.
>> Yeah, but now let's actually take that analogy, that's a great analogy,
let's take that analogy and apply it to a system that we wanna make sure we get.
What if we throw the ball and it bounces and we miss it?
>> [LAUGH] >> Right, cuz this device isn't moving,
it's not able to reach its arms to the left or
to the right, so- >> And
we're not professional athletes, either, so.
>> Yeah. [LAUGH]
>> We're engineers.
>> Yeah, so what if we miss the ball, right?
We wanna make sure we catch this ball, or at least one of the balls, right?
So look at this diagram up here and you can see now we have these three graphs.
One which is the trigger, one which is the transmitter output, and
one which is the echo output.
Now the trigger is what I said is one of those GPIOs that we write onto the device.
And now this is the cool part.
We write onto the device and we say, voltage high.
The device then says, okay, I'm gonna throw out these balls, right?
Or this ball.
>> [LAUGH] >> Instead of throwing out one ball
though, it throws out eight, right?
So it says, I'm gonna throw out eight balls.
Well I mean technically it's actually eight waves,
eight signals at 40 kilohertz each.
So at that exact moment it also triggers the echo to go high.
>> Basically you're waiting.
>> Yeah so now you're waiting.
You threw the one, you triggered it,
threw eight balls, now you're waiting, echo's high.
It bounces off the wall, eight of them bounce off the wall,
you catch one so you win.
>> Yeah. >> [LAUGH] And then echo goes low,
you take the time, divide it by the speed or yeah,
divide it by the speed and you got it.
All right cool so, there you go.
Now you have a one more little helper here.
We got both of those pictures that we used in the last two slides,
we're gonna merge them together to hopefully get you understanding this
a little better if you didn't already.
So first thing that happens, you have all those little 1s on the screen.
That's what happens first, you- >> Your first event.
>> Your first event.