1 00:00:00,570 --> 00:00:07,860 Hello and welcome to the stimulus on Energy are going to explain how to deal with analog and both VSP 2 00:00:07,860 --> 00:00:13,350 30 toolbelt now to test the input analog value signals. 3 00:00:13,510 --> 00:00:21,030 There are about 18 12 with ADC input channels. 4 00:00:22,070 --> 00:00:29,300 You can easily recognize them from the wiring diagram, the one that we already mentioned, all of the 5 00:00:29,300 --> 00:00:37,250 pain out there that we explained in a previous lesson, and there is only one thin bit and a digital 6 00:00:37,250 --> 00:00:39,070 converter on the MCU. 7 00:00:39,860 --> 00:00:46,220 Now, depending on the ball that you are using, this pen can be at a different location. 8 00:00:46,460 --> 00:00:50,720 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:03,310 Pins, so all of these are our digital converter enabled pens and there are other pens as well. 11 00:01:06,240 --> 00:01:15,620 Again, here's AC1 and Aissatou, so different channels and you can recognize them, was with the general 12 00:01:15,660 --> 00:01:20,160 purpose input output PIN number starting from PIN. 13 00:01:20,460 --> 00:01:29,970 As you can see here, a pin to has ADC pin for PIN 15 PIN one doesn't have ADC. 14 00:01:30,390 --> 00:01:35,060 So it's something from point zero then you can move on. 15 00:01:35,100 --> 00:01:40,070 That has been to for 12, 13, 14, 15 and so on. 16 00:01:40,080 --> 00:01:43,440 We only need one pin for this lassonde. 17 00:01:43,890 --> 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 18 00:01:52,230 --> 00:01:53,250 and our coding. 19 00:01:54,860 --> 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 20 00:02:02,360 --> 00:02:03,220 36. 21 00:02:03,650 --> 00:02:10,370 It has eight one six zero or Channel zero now to release value. 22 00:02:10,400 --> 00:02:17,310 We need to use the analog read function and we saw the analog value on a variable. 23 00:02:18,020 --> 00:02:26,930 It's very important to note that the speed 32 analysts are convertor have 12 bits of resolution versus 24 00:02:26,930 --> 00:02:30,820 10 bits on E.S.P eight two, six, six and Arduino. 25 00:02:31,310 --> 00:02:41,410 So the total range of the analog to digital conversion readings can go to 4000 zero nine five or 095 26 00:02:41,470 --> 00:02:50,510 five instead of 1000 zero twenty seven on Arduino and SB eight two six six, when a maximum of three 27 00:02:50,510 --> 00:02:53,400 point three volts is applied to its input. 28 00:02:53,510 --> 00:03:00,200 So you can expect more values that can go up to 4000. 29 00:03:00,650 --> 00:03:08,630 Now for input, let's use, I think, your on potential meter or any analog sensor that we have and 30 00:03:08,630 --> 00:03:12,830 we can connect it from the three point three volt and ground. 31 00:03:13,310 --> 00:03:21,450 Now let's use its variable output to be the input of the E.S.P 32 ADC bands to get started. 32 00:03:21,680 --> 00:03:23,660 Let's open up our software. 33 00:03:24,410 --> 00:03:26,420 Go Arduino IVI. 34 00:03:30,890 --> 00:03:34,010 Now, after opening up Padrino Idee. 35 00:03:36,460 --> 00:03:38,440 OK, let me open up the other software. 36 00:03:41,320 --> 00:03:42,820 OK, here it is. 37 00:03:45,110 --> 00:03:46,160 Hardware and software. 38 00:03:48,710 --> 00:03:55,460 Now, the first step that we are going to do is create a new sketch, let's make sure that our board 39 00:03:55,730 --> 00:04:03,870 is connected and recognized, as you can see, at Confort, and let's make sure that we have the right 40 00:04:03,870 --> 00:04:05,030 port selected. 41 00:04:06,430 --> 00:04:08,440 Our case, SPF 30 to. 42 00:04:12,480 --> 00:04:19,770 As you can see, do it as we set it to the gate and we have other libraries that can cover this. 43 00:04:21,200 --> 00:04:22,800 Now, this is our board. 44 00:04:25,140 --> 00:04:33,360 Let's start coding, the first thing that we need to do is go to the void setup and initialize the serial 45 00:04:33,360 --> 00:04:35,760 communication serial again 46 00:04:38,700 --> 00:04:40,440 and we can choose any moderate. 47 00:04:40,440 --> 00:04:46,320 Let's choose eleven thousand five hundred five thousand two hundred. 48 00:04:47,970 --> 00:04:53,640 Um, now let's add a delay so that this kind of supplies. 49 00:04:57,040 --> 00:05:05,530 The CIA communication with your print, a sentence indicating that we are using E.S.P. 50 00:05:09,640 --> 00:05:23,530 32 analog interest now up here, let's initialize a variable, save the data, so end analog value. 51 00:05:26,650 --> 00:05:37,250 Equals zero, then inside the void loop, right, and value equals and an agreed, just like an Arduino. 52 00:05:38,440 --> 00:05:40,990 And from here, we need to select a pin. 53 00:05:41,500 --> 00:05:44,830 In our case, it's the general purpose. 54 00:05:44,830 --> 00:05:45,610 And what output? 55 00:05:45,610 --> 00:05:47,500 PIN 36. 56 00:05:49,580 --> 00:05:57,830 After that, let's print the analog read value, so cereal that print. 57 00:06:03,430 --> 00:06:07,780 Now, that's based out of creed, which has done a value and it's solidly. 58 00:06:11,650 --> 00:06:12,970 Five hundred milliseconds. 59 00:06:13,730 --> 00:06:15,610 OK, let's verify. 60 00:06:17,550 --> 00:06:22,860 Let us save the codes, let's call it a.. 61 00:06:40,680 --> 00:06:42,960 It will take some time to compile a sketch. 62 00:06:51,230 --> 00:06:57,890 Now, let's upload the sketch to our E.S.P board, make sure that your boards connected. 63 00:06:59,610 --> 00:07:03,540 And you have selected the right board and the right comport. 64 00:07:06,630 --> 00:07:10,080 OK, as you can see, it's uploading. 65 00:07:21,830 --> 00:07:30,080 OK, writing, OK, done uploading now if we went and open up here, Serializer. 66 00:07:30,470 --> 00:07:34,970 OK, we have this science chance, the moderate to. 67 00:07:36,350 --> 00:07:41,690 Hundred fifteen thousand two hundred, as you can see here, we have zero value now, if you played 68 00:07:41,690 --> 00:07:48,650 with the analog potential meter, you will get values up to 4000 and that's it. 69 00:07:48,880 --> 00:07:58,400 This is how easy it is to use analog pins on the USB port, the same Arduino coding, same structure. 70 00:07:58,400 --> 00:08:00,190 And I would have every line. 71 00:08:00,200 --> 00:08:00,560 Thanks. 72 00:08:00,570 --> 00:08:05,240 Watching this last one, if you have any question, please ask in the Q&A about.