1
00:00:00,570 --> 00:00:06,630
Hello and welcome to this, and you us on LHR going to explain how to deal with analog input.

2
00:00:07,140 --> 00:00:13,320
They ask P32 Board now to test the input analog value signals.

3
00:00:13,500 --> 00:00:20,970
There are about 18 12 bit ADC input channels.

4
00:00:22,100 --> 00:00:26,330
You can easily recognize them from the wiring diagram.

5
00:00:26,840 --> 00:00:32,090
The one that we already mentioned, all of the pin out diagram that we explained in our previous lesson,

6
00:00:33,470 --> 00:00:41,030
and there is only one tin bit and a digital converter on the road to, you know, depending on the ball

7
00:00:41,030 --> 00:00:46,220
that you are using, this pen can be at a different location.

8
00:00:46,460 --> 00:00:47,840
Let me show you the pin out.

9
00:00:49,040 --> 00:00:50,660
Now, as you can see in this image.

10
00:00:52,500 --> 00:00:54,060
You can see the ADC.

11
00:00:55,070 --> 00:01:00,560
Pins, so all of these art and digital converter enabled pens.

12
00:01:01,130 --> 00:01:03,290
And there are other pens as well.

13
00:01:06,300 --> 00:01:08,880
Again, here's issue one.

14
00:01:08,910 --> 00:01:16,200
And these are two so different channels, and you can't recognize them was with a general purpose and

15
00:01:16,200 --> 00:01:20,130
without a pin number starting from then.

16
00:01:20,520 --> 00:01:32,160
As you can see here, Penta has ADC been four point fifteen PIN, one doesn't have ADC, so it's starting

17
00:01:32,160 --> 00:01:33,060
from PIN zero.

18
00:01:33,720 --> 00:01:34,980
Then you can move on.

19
00:01:35,100 --> 00:01:40,040
That has been to four, 12, 13, 14, 15 and so on.

20
00:01:40,070 --> 00:01:43,410
We only need one pin for this lesson.

21
00:01:43,920 --> 00:01:52,230
So to read that and what you will use the same as an Arduino boards, we will use the analog read function

22
00:01:52,230 --> 00:01:53,190
and our coding.

23
00:01:54,890 --> 00:02:02,090
Now, as you can see, the pain that we are going to use for this example is general purpose input output.

24
00:02:02,420 --> 00:02:03,230
36.

25
00:02:03,650 --> 00:02:08,300
It has eight one six zero or child zero.

26
00:02:09,169 --> 00:02:16,700
Now, to reach this value, we need to use the analogy function and we need to store the value on a

27
00:02:16,700 --> 00:02:17,300
variable.

28
00:02:18,050 --> 00:02:22,490
It's very important to note that VSP, P32 and these are convert.

29
00:02:22,490 --> 00:02:30,830
I'll have 12 bits of resolution versus 10 bits on SB eight, two, six six and Arduino.

30
00:02:31,310 --> 00:02:40,670
So the total range of the analog to digital conversion readings can go to 4000 zero nine five or zero

31
00:02:40,670 --> 00:02:52,700
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

32
00:02:52,710 --> 00:02:53,150
its end.

33
00:02:53,540 --> 00:03:01,660
So you can expect more values that can go up to 4000 now for input.

34
00:03:01,670 --> 00:03:09,740
Let's use our thinking or potential meter or any analog since all that we have and we can connect it

35
00:03:10,160 --> 00:03:12,800
from the three point three volt and ground.

36
00:03:13,340 --> 00:03:21,410
Now let's use its variable output to be the input of the Speaker 32 ADC pins to get started.

37
00:03:21,710 --> 00:03:23,600
Let's open up Arduino software.

38
00:03:24,440 --> 00:03:26,420
Go for Arduino IEEE.

39
00:03:30,890 --> 00:03:33,980
Now, after opening up our regional I.D..

40
00:03:36,730 --> 00:03:38,410
It went up the other software.

41
00:03:41,350 --> 00:03:42,790
OK, here it is.

42
00:03:45,140 --> 00:03:46,130
Hardware and software.

43
00:03:48,710 --> 00:03:51,920
Now, the first step that we are going to do is create a new sketch.

44
00:03:52,970 --> 00:03:58,880
Let's make sure that our port is connected and organized, as you can see at come.

45
00:04:00,230 --> 00:04:04,970
And let's make sure that we have the right port selected.

46
00:04:06,490 --> 00:04:08,410
Our case SPF 32.

47
00:04:12,550 --> 00:04:15,710
As you can see, though, it is both hats off to the kids.

48
00:04:16,320 --> 00:04:19,709
And we have other libraries that can cover this.

49
00:04:21,180 --> 00:04:22,770
Now this is our world.

50
00:04:25,200 --> 00:04:26,280
Let's start coding.

51
00:04:26,460 --> 00:04:34,050
The first thing that we need to do is go to the void set up and initialize the serial communication

52
00:04:34,320 --> 00:04:35,730
serial again,

53
00:04:38,730 --> 00:04:46,260
and we can choose anybody that shows eleven thousand five hundred five thousand two hundred.

54
00:04:48,000 --> 00:04:53,610
Um, now let's add a delay so that this kind of supplies.

55
00:04:57,070 --> 00:05:05,500
The Syria communication module and lists print a sentence indicating that we are using ISP.

56
00:05:09,820 --> 00:05:20,520
Thirty two analog and test now up here, let's initialize a variable to save the analog data.

57
00:05:20,530 --> 00:05:23,530
So and analog value.

58
00:05:26,650 --> 00:05:27,610
Equals zero.

59
00:05:29,200 --> 00:05:37,240
Then inside the void loop, right out of value equals analog read just like an angel.

60
00:05:38,500 --> 00:05:42,400
And from here, we need to select the pen lowercase.

61
00:05:42,940 --> 00:05:45,880
Its general purpose input output pen.

62
00:05:46,540 --> 00:05:47,470
Thirty six.

63
00:05:49,640 --> 00:05:57,800
After that, let's print the analog great value, so serial dot print.

64
00:06:03,430 --> 00:06:07,780
Now, loosely based out of Create, which has done a value and decidedly.

65
00:06:11,650 --> 00:06:12,940
Five hundred milliseconds.

66
00:06:13,760 --> 00:06:15,580
OK, let's verify.

67
00:06:17,550 --> 00:06:19,500
Let us save the codes.

68
00:06:20,490 --> 00:06:25,350
Let's call it A. The.

69
00:06:40,710 --> 00:06:42,930
It will take some time to compile a sketch.

70
00:06:51,200 --> 00:06:54,640
Now, let's applaud the sketch.

71
00:06:55,070 --> 00:06:55,980
Yes, be bold.

72
00:06:56,000 --> 00:06:57,860
Make sure that your boards connected.

73
00:06:59,640 --> 00:07:03,480
And you have selected the right board upon the right comport.

74
00:07:06,630 --> 00:07:07,010
OK.

75
00:07:07,050 --> 00:07:10,050
As you can see, it's uploading.

76
00:07:21,830 --> 00:07:22,240
OK.

77
00:07:22,410 --> 00:07:23,180
Writing.

78
00:07:24,560 --> 00:07:25,820
OK, then uploading.

79
00:07:25,850 --> 00:07:33,740
Now, if we went and opened up here, Syria to monitor, OK, we have this science challenge the moderate

80
00:07:34,550 --> 00:07:34,970
to.

81
00:07:36,250 --> 00:07:40,340
One hundred fifteen thousand two hundred, as you can see here, we have zero value.

82
00:07:40,760 --> 00:07:47,060
Now, if you played with the potential meter, you will get values up to 4000.

83
00:07:47,780 --> 00:07:48,590
And that's it.

84
00:07:48,890 --> 00:07:54,830
This is how easy it is to use analog pins on the USB port.

85
00:07:55,490 --> 00:08:00,170
The same Arduino coding, same structure and discipline every line.

86
00:08:00,200 --> 00:08:01,660
Thanks for watching this last one.

87
00:08:01,670 --> 00:08:05,300
If you have any question, please ask in the Q&A about.

