Hello and welcome to this, and you us on LHR going to explain how to deal with analog input.
They ask P32 Board now to test the input analog value signals.
There are about 18 12 bit ADC input channels.
You can easily recognize them from the wiring diagram.
The one that we already mentioned, all of the pin out diagram that we explained in our previous lesson,
and there is only one tin bit and a digital converter on the road to, you know, depending on the ball
that you are using, this pen can be at a different location.
Let me show you the pin out.
Now, as you can see in this image.
You can see the ADC.
Pins, so all of these art and digital converter enabled pens.
And there are other pens as well.
Again, here's issue one.
And these are two so different channels, and you can't recognize them was with a general purpose and
without a pin number starting from then.
As you can see here, Penta has ADC been four point fifteen PIN, one doesn't have ADC, so it's starting
from PIN zero.
Then you can move on.
That has been to four, 12, 13, 14, 15 and so on.
We only need one pin for this lesson.
So to read that and what you will use the same as an Arduino boards, we will use the analog read function
and our coding.
Now, as you can see, the pain that we are going to use for this example is general purpose input output.
36.
It has eight one six zero or child zero.
Now, to reach this value, we need to use the analogy function and we need to store the value on a
variable.
It's very important to note that VSP, P32 and these are convert.
I'll have 12 bits of resolution versus 10 bits on SB eight, two, six six and Arduino.
So the total range of the analog to digital conversion readings can go to 4000 zero nine five or zero
nine two five and a set of 1000 027 on SB eight two six six when a maximum of 3.3 volt is applied to
its end.
So you can expect more values that can go up to 4000 now for input.
Let's use our thinking or potential meter or any analog since all that we have and we can connect it
from the three point three volt and ground.
Now let's use its variable output to be the input of the Speaker 32 ADC pins to get started.
Let's open up Arduino software.
Go for Arduino IEEE.
Now, after opening up our regional I.D..
It went up the other software.
OK, here it is.
Hardware and software.
Now, the first step that we are going to do is create a new sketch.
Let's make sure that our port is connected and organized, as you can see at come.
And let's make sure that we have the right port selected.
Our case SPF 32.
As you can see, though, it is both hats off to the kids.
And we have other libraries that can cover this.
Now this is our world.
Let's start coding.
The first thing that we need to do is go to the void set up and initialize the serial communication
serial again,
and we can choose anybody that shows eleven thousand five hundred five thousand two hundred.
Um, now let's add a delay so that this kind of supplies.
The Syria communication module and lists print a sentence indicating that we are using ISP.
Thirty two analog and test now up here, let's initialize a variable to save the analog data.
So and analog value.
Equals zero.
Then inside the void loop, right out of value equals analog read just like an angel.
And from here, we need to select the pen lowercase.
Its general purpose input output pen.
Thirty six.
After that, let's print the analog great value, so serial dot print.
Now, loosely based out of Create, which has done a value and decidedly.
Five hundred milliseconds.
OK, let's verify.
Let us save the codes.
Let's call it A. The.
It will take some time to compile a sketch.
Now, let's applaud the sketch.
Yes, be bold.
Make sure that your boards connected.
And you have selected the right board upon the right comport.
OK.
As you can see, it's uploading.
OK.
Writing.
OK, then uploading.
Now, if we went and opened up here, Syria to monitor, OK, we have this science challenge the moderate
to.
One hundred fifteen thousand two hundred, as you can see here, we have zero value.
Now, if you played with the potential meter, you will get values up to 4000.
And that's it.
This is how easy it is to use analog pins on the USB port.
The same Arduino coding, same structure and discipline every line.
Thanks for watching this last one.
If you have any question, please ask in the Q&A about.