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