Hello, guys, and welcome back and this lecture, we're going to start a small project about controlling
a motor, that's a great so first thing we want to do is go to Croquette.
And I'm sure you've seen the introduction, the previous lecture.
So now we can start doing something cool with that.
So I want to go into components right here and just choose Arduino and I'm going to choose a breadboard.
So this will give me an original with a report.
By the way, you can use the mouse wheel in order to zoom in and out.
OK, so.
Right now, we have a breadboard, which we've talked about, and we have an original.
What else do we need?
Actually, what I need is Amadiya.
So if you go to all.
And we scroll down, you're going to see this, how big you Moja so this motor has two terminals, positive
and negative.
Now, if you connect a battery to the positive and the negative, this will rotate immediately.
How about we make this Awdry no control the whole process?
So I want one push button to start it and another push button to stop it.
OK.
So in order to do that, we are going to need some buttons.
Let's go to Basic and let us choose these Bush buttons.
So we have one here.
And we have another push button here.
OK, so this is maybe for a start and this is first stop right now, you might see that it has four
terminals.
Well, because you could use these two terminals together or you could use these terminals together
so we could use this new terminal.
So when we press the button, the closer will the switch between these two points.
Remember that the switch is only two points.
And when we press a button, these two points are going to be connected to each other so we can easily
use this to all these two.
So it's like a two way push button, actually, but we are going to use only these two terminals.
We only need one way of.
And here it's the same we're going to use this to OK.
So how is this going to work?
Well, first of all, as you can see, we have the five volt energy and connected to the Bridport.
So now all of this line has a five volt and all of this line has indeed.
Now, whenever you have two electronic components and you have one unified voltage source, like in
our case, the voltage source is this five volt coming out of the original.
Right now, whenever you have two devices, you need to unify your grounds.
What does this mean?
Well, see this ground?
We're going to take it and connect it to the ground here.
Now, what did we do here?
We are literally connecting the ground of the motor to the ground of the original.
OK, so now we can take the positive and make some control by disconnecting and connecting this positive.
This motor will rotate as we need.
OK, so let's see how we can do that.
Now we have unified the grounds.
So that the circuit can be completed, we can now take care of the buttons.
Now, these two buttons will not really connect to the motor at all.
No, this is not our goal.
Our goal is the Audrina is going to be reading this button and it's going to initiate the signal from
some other pin to the motor.
Bear with me here.
Now, if I take this positive and simply connected to a.
Like this, when the arena is going to give the command, a five vaulters will come from the eight men
right here, OK, and will make this more to rotate.
Right, because this positive is expecting a five volt or a high voltage.
In our case, it's survival.
So whenever we give a five volt here and we have already connected the negative, so the circuit is
complete between positive and negative, between ordering the motor, then we're going to have this
motor rotating.
Now, these two buttons will be connected to different pins.
So PIN number two will have the start button and PIN number three will have the stoppered.
So if I press start.
The ordinary, it starts, it's going to initiate a high voltage here, which will activate the motor
if I press stop the pin number three is going to read my stop command and it's going to give a zero
volt here if I give a novelty to the positive.
Well, this motor has no power to rotate, so it will stop, OK.
Now, remember, a switch need to be connected from both sides.
Right.
So what are we trying to do here?
We are connecting it to the pin.
As we have learned before, we need to connect this to the ground.
So let's take this to the ground right here.
You could connect them here as well, but on the other side as well.
And you connect it to the negative here as well.
OK, you can choose any of these pins or any of these pins.
It doesn't really matter.
So what's happening is if I press the button.
This agenda is going to come all the way to pin number two, if I release the button, I am going to
program this to be pull up.
So we're going to be reading your remember the pullup lecture we have talked about.
Well, this is what's going to happen.
Same thing here.
If this is addressed as your vote will come all the way to number three, if I release the button,
it will be floating from this side.
But internally, because it's an input bill up, it will be reading a high voltage or a high signal.
OK.
The next lecture, we're going to start writing the code.
So let's sum it up again.
You start it's rich from pin number to number eight.
Gives the voltage here and this will rotate if your PIN number three is going to read that and PIN number
eight is going to give a zero volt and this motor will stop.
So it's the start stop button to control the motor.
Next, that you're going to start quoting.