WEBVTT

00:00.180 --> 00:06.730
And now that you have added your photoresistor to your annual secret, let's see how to get some values

00:06.750 --> 00:07.360
from it.

00:07.830 --> 00:10.490
So that is super, super easy here.

00:10.500 --> 00:16.520
We don't need any library to read from the scene, so we just need to use the analog grade function.

00:16.830 --> 00:22.610
So first, I'm going to define a photo register.

00:23.700 --> 00:31.590
Being, which is a zero, so make sure this is an honor to in this setup to remove that, I don't need

00:31.590 --> 00:35.740
to use spin mode because this is already an analog input being.

00:35.790 --> 00:39.080
OK, if you'll remember, from the analog pings section.

00:39.630 --> 00:48.900
So Nossiter and in the loop, if I want to get disvalue, I just do analog read with the photoresistor

00:49.290 --> 00:53.560
thing and I get the video so I know what I'm going to do.

00:53.910 --> 00:57.600
I'm just going to print it so that Biggin.

00:59.570 --> 01:04.880
OK, I'm just going to put that inside, so, yeah, that's right, and so we can monitor it.

01:05.310 --> 01:11.490
And then for the sake of this example, I'm going to add a delay of one hundred, OK, that I'm, of

01:11.490 --> 01:15.450
course, not going to use when we do the following activities and final project.

01:16.110 --> 01:18.300
But here we just want to test one thing quick.

01:18.570 --> 01:20.250
So let's just add a small delay.

01:20.250 --> 01:21.920
And that's really not the problem here.

01:22.170 --> 01:30.690
So I'm going to upload now the code to the original, let's name it to the stop.

01:34.790 --> 01:41.200
And let's open the Syrian money to oil and let's see what we get here so we can some values.

01:41.810 --> 01:45.170
Three hundred seventy, 60, 80 something.

01:45.200 --> 01:49.790
OK, so this is the actual measurement of the SENSEOR.

01:50.090 --> 01:55.520
So between zero, which is the minimum, which is completely dark, and one thousand twenty three,

01:55.760 --> 01:58.760
which should be completely like one hundred percent light.

01:59.330 --> 02:06.320
So now if I put my hand on something on top of the sensor so you can see the luminosity is reduced and

02:06.320 --> 02:10.970
what we are going to right now is 40 something, so it doesn't go to zero.

02:11.320 --> 02:14.630
OK, as you can see, the value here is not zero.

02:14.630 --> 02:19.310
Is 40 something that that's the minimum I can get basically here it seems.

02:19.890 --> 02:24.020
So I remove my hand and no, we are going back to three hundred sixty something.

02:24.290 --> 02:26.750
I'm going to add some more lights to the room.

02:27.170 --> 02:30.860
OK, just OK right now.

02:31.070 --> 02:40.730
And you can see now we are at seven hundred fifty something so I'm going to turn off the light and we

02:40.730 --> 02:43.160
are going back to three hundred seventy.

02:44.290 --> 02:49.090
So the value you get here, just values, then you need to interpret them.

02:49.390 --> 02:54.740
So now it would be up to you to define actually what values correspond to what.

02:54.760 --> 03:01.480
OK, so what you can do is try in your own government when you have a full light, see what is the value

03:01.480 --> 03:03.790
you get and then try it with a low light.

03:04.060 --> 03:08.880
Maybe try at night, OK, if you want to measure outside and try outside, OK.

03:08.890 --> 03:12.960
And just note the different values you get for different threshold.

03:13.210 --> 03:19.110
So then you will be able to create some defines for the thresholds you want.

03:19.120 --> 03:24.250
So in your code you can compare the value you get with those threshold and that's what we are going

03:24.250 --> 03:24.550
to do.

03:24.670 --> 03:31.040
So in the following activities, so to recap, to use the photoresistor or you just use it with another

03:31.060 --> 03:32.220
great function, that's it.

03:32.530 --> 03:38.920
You get a value between zero and one thousand twenty three and then you can test this sense in different

03:38.920 --> 03:46.000
under different luminosities and interpret the values you get to define some thresholds, for example,

03:46.000 --> 03:51.170
to put on an entity or to start another actions and what we can do.

03:51.190 --> 03:54.160
So in the 80s, use the sale plotter.

03:54.880 --> 03:56.620
OK, so that's quite convenient here.

03:56.620 --> 03:59.410
You can see I have my authority store.

03:59.440 --> 04:05.380
I put my hand on top of it and then I remove it so you can see the evolution of the value.
