WEBVTT

00:00.210 --> 00:07.050
Actually, that's not all for another piece you have seen that you can use analog input to a range of

00:07.050 --> 00:13.680
values from an analog sensor, but analog things are, in fact, also digital.

00:14.700 --> 00:20.550
So by default, if you don't set a model for an analog pin and use the grid function, then it would

00:20.550 --> 00:22.590
work as an analog input pin.

00:22.590 --> 00:30.510
But then you can also use ping mode to choose a mode and use the pin, just like you would use a digital

00:30.510 --> 00:30.870
pin.

00:31.120 --> 00:35.280
For example, you can connect an energy to an analog pin in your code.

00:35.280 --> 00:42.030
You could use B mode with output and then you can give high and low values to actuate, just like we

00:42.030 --> 00:42.550
did before.

00:42.780 --> 00:50.790
Note that for analog things like I have previously said, you can't use the same functionality are.

00:50.880 --> 00:53.610
In other words, the analog right function.

00:54.270 --> 00:58.140
Using an analog print as a digital pen can be very useful.

00:58.150 --> 01:05.100
For example, if you need to connect a new digital component and all your digital pins are already used.

01:05.530 --> 01:10.390
So what I recommend by default is to use digital pins when you have a digital component.

01:10.490 --> 01:18.330
OK, and I know because when you have an analog sensor by not mixing them, you will keep things clearer

01:18.330 --> 01:18.830
for you.

01:19.050 --> 01:25.200
And of course, if you need a more digital things, then go ahead and use an analog pin as a digital

01:25.200 --> 01:25.550
pin.

01:26.810 --> 01:30.170
So just to show you how you can use another pin as a digital pin.

01:30.350 --> 01:37.850
Well, I'm going to go back to the front secret that we have here and just change the pin for the Eddie.

01:39.730 --> 01:44.300
All right, so now the energy is going to be, as you can see, to pin number 11.

01:44.650 --> 01:47.630
I'm just going to change that a little.

01:47.700 --> 01:48.840
Let's remove it.

01:49.150 --> 01:50.300
That's directly connected.

01:50.300 --> 02:01.440
So this leg of the resistor to switch, make it lean in, that's connected actually to a pipe.

02:01.960 --> 02:07.320
So the energy is now connected to an analog in effect.

02:07.810 --> 02:09.940
And the rest of the circuit here doesn't change.

02:10.920 --> 02:14.310
And let's really find the real secret as well to make the test.

02:14.820 --> 02:21.960
And so I have disconnected and you know, and here we have so we have this where we're going to change

02:21.960 --> 02:27.750
this for you, which is connected between one leg of there is this talk here which is connected to the

02:27.750 --> 02:30.260
entity and PIN number even here.

02:30.720 --> 02:37.380
So I'm going to connect it to be number eight five over there instead, because this wire is quite small.

02:37.390 --> 02:38.930
I'm going to use a longer one.

02:38.940 --> 02:40.860
So I'm just going to disconnect this.

02:42.000 --> 02:43.350
But this year instead.

02:45.200 --> 02:48.470
Yeah, I like correct.

02:49.750 --> 02:56.500
That and then all the way to a buy last on this wall here.

02:57.130 --> 02:57.640
All right.

02:59.270 --> 03:06.580
And now let's simply make this and blink, so I'm going to open the.

03:08.120 --> 03:11.530
So go back to your programs, go back to the program.

03:12.230 --> 03:18.430
And so here we make the energy building and just going to remove that construction.

03:18.440 --> 03:26.510
OK, so we just set up the energy as an output beam we demoed and then we just make it blink every five

03:26.510 --> 03:29.250
hundred milliseconds instead of 12.

03:29.270 --> 03:32.540
I'm simply going to write a five.

03:33.290 --> 03:39.650
OK, so as you can see, the code is the exact same if we use the energy on a digital pin or another

03:39.650 --> 03:39.970
pin.

03:40.190 --> 03:47.540
But just because we use this, we spin mode with any dippin an output, then this analog will behave

03:47.540 --> 03:49.400
just as a digital thing.

03:49.760 --> 03:55.790
Just don't forget, without the Pelago, um, functionality, let's upload code and.

03:57.830 --> 04:05.090
Actually, it's better if I plug my in arianism so you can see you will get these are all, for example,

04:05.090 --> 04:09.530
bought at CM five is not available, so now it is plugged in.

04:09.530 --> 04:10.640
I can upload the code.

04:12.670 --> 04:17.870
And well, as you can see, the Elvie is blinking OK, just like it was previously.

04:18.190 --> 04:23.260
So we have successfully used another pin as a digital pin and.

04:23.290 --> 04:26.800
All right, that's the end of the section on Wrapping's.
