1 00:00:00,480 --> 00:00:07,650 Now that we are done with the little blinking example, let's move on to the touch sensor, for example. 2 00:00:10,040 --> 00:00:19,340 This is a new cool feature that's available on the E.S.P 32 bawls, VSP 32 has internal alten, internal 3 00:00:19,340 --> 00:00:20,710 capacitive touch sensors. 4 00:00:21,080 --> 00:00:25,010 We already explained or showed the spin's. 5 00:00:29,750 --> 00:00:31,880 We already showed. 6 00:00:35,860 --> 00:00:42,910 Well, the exit plan depends on the wiring layout of the speaker to listen, but let's talk about them 7 00:00:42,910 --> 00:00:44,550 again now. 8 00:00:44,950 --> 00:00:49,210 These eastern antenna capacitive touch sensors can be used as buttons. 9 00:00:50,020 --> 00:00:53,770 And there are numbers from general-purpose and what output? 10 00:00:53,770 --> 00:01:05,410 Number four zero to 12, 13, 14, 15 at 23 or 32, 33 and 27. 11 00:01:06,280 --> 00:01:07,390 These are the pens. 12 00:01:07,390 --> 00:01:11,310 I will show you the bends number in a minute, OK? 13 00:01:13,790 --> 00:01:15,810 OK, this is it. 14 00:01:15,820 --> 00:01:24,370 And you can refer to the wiring layout or the pin diagram lesson where you can see these pins. 15 00:01:24,910 --> 00:01:34,800 These are 10 internal capacitive touch sensors that you can easily use in order to read these pins. 16 00:01:34,810 --> 00:01:38,350 What you need to do is use the function touch. 17 00:01:38,350 --> 00:01:38,760 Right. 18 00:01:39,850 --> 00:01:50,140 And this function will take only one variable, which is basically this is the function and it usually 19 00:01:50,140 --> 00:01:57,550 takes one variable, which is the PIN number, the serial number four, number five and so on. 20 00:01:58,680 --> 00:01:59,160 So. 21 00:02:00,810 --> 00:02:06,370 In order to use this function first, we need to assign a variable. 22 00:02:08,050 --> 00:02:12,990 Now we can write int value. 23 00:02:19,440 --> 00:02:21,060 And right touch Reed 24 00:02:24,600 --> 00:02:30,930 inside that vehicle, like any number, we can use that purpose input output for which basically the 25 00:02:30,930 --> 00:02:33,060 first touch since Sorte zero. 26 00:02:33,840 --> 00:02:42,930 And now let's create a code where we read the state of this touch sensor and submit on the Syrian monitor 27 00:02:43,530 --> 00:02:44,370 to do this. 28 00:02:44,400 --> 00:02:46,380 First, you need to. 29 00:02:47,590 --> 00:02:53,870 Initialize the communication in the setup method, as you can see, between these two curly parentheses. 30 00:02:54,700 --> 00:03:00,910 So right serial dot begin 31 00:03:03,670 --> 00:03:09,990 and use and what rate we can use one hundred fifteen thousand two hundred. 32 00:03:10,330 --> 00:03:14,230 And let's add some delay to help with 33 00:03:17,260 --> 00:03:18,100 stabilize. 34 00:03:22,760 --> 00:03:24,920 One second now. 35 00:03:26,110 --> 00:03:29,760 Let's try this nonsense, let's try serial, not print. 36 00:03:37,250 --> 00:03:38,630 Yes, be fair to. 37 00:03:42,450 --> 00:03:43,080 Touch 38 00:03:48,090 --> 00:03:59,370 this now we have to set the mood for the US as output, we want to use the lid as an indicator for the 39 00:03:59,370 --> 00:04:02,610 Dutch state or the Dutch since all state. 40 00:04:03,390 --> 00:04:11,010 So we have been number two, which has the lid, and we need it as output. 41 00:04:13,700 --> 00:04:19,840 We also need to write a value and make sure that it equals zero. 42 00:04:21,240 --> 00:04:24,630 We want to make sure that the lid is off. 43 00:04:26,910 --> 00:04:27,740 To do so. 44 00:04:27,780 --> 00:04:30,570 We need to write the PIN number and write law. 45 00:04:31,470 --> 00:04:32,390 Using this line. 46 00:04:32,400 --> 00:04:40,830 We are making sure that when the E.S.P board starts, it will make sure that that it is off. 47 00:04:41,200 --> 00:04:46,320 It will only be a loan if there is touch or if the touch sensors on. 48 00:04:48,030 --> 00:04:55,770 OK, now what we need to do next is read the value, touch, read using touch, read and saw inside 49 00:04:55,770 --> 00:04:56,310 the value. 50 00:04:57,160 --> 00:04:59,460 Now we want to ask a question. 51 00:04:59,820 --> 00:05:06,630 If the touch value is above or below a certain value, we can turn on or off the. 52 00:05:09,350 --> 00:05:15,280 But before we do that, we can simply print that judge, read all the value that we get from the touch 53 00:05:15,290 --> 00:05:19,390 screen sensor, which is the capacitive touch sensor on the Syrian monitor. 54 00:05:19,430 --> 00:05:30,260 So let's get let's do this serial dot print online and inside it. 55 00:05:30,260 --> 00:05:31,900 We need to place the value. 56 00:05:33,470 --> 00:05:38,750 After that, we can add a delay on second delay. 57 00:05:40,920 --> 00:05:42,960 Now, let's try combining our code. 58 00:05:45,200 --> 00:05:47,330 Let's store it inside. 59 00:05:51,410 --> 00:05:57,400 Our coding folder, it's called Touch Screen Example. 60 00:06:04,890 --> 00:06:06,300 OK, let's remove this. 61 00:06:10,150 --> 00:06:11,670 Now, let's come back again. 62 00:06:23,160 --> 00:06:28,680 OK, done compiling now let's upload the code to our E.S.P board. 63 00:06:48,250 --> 00:06:55,450 By the way, you can use number four, which is the PIN number, or you can use to zero to one, three 64 00:06:55,450 --> 00:07:02,680 to up to T10, because we already mentioned that we have, uh, ten touch sensors. 65 00:07:04,360 --> 00:07:06,520 Now, let's open up the serial monitor. 66 00:07:08,030 --> 00:07:12,830 OK, as you can see, that much value here is 100. 67 00:07:14,490 --> 00:07:19,830 And seven, and if we did touch it, it will change. 68 00:07:20,100 --> 00:07:20,990 Let me do that. 69 00:07:22,570 --> 00:07:29,070 OK, now, as you can see, we have a 74, 37, 71, 70. 70 00:07:29,110 --> 00:07:30,610 Now let me touch that, Ben. 71 00:07:33,940 --> 00:07:39,940 As you can see, once I touched upon the values goal below, then. 72 00:07:41,800 --> 00:07:43,090 And when I leave it. 73 00:07:44,310 --> 00:07:52,260 Goes again, up to seventy seven to two, so I think that we have a constant value here. 74 00:07:52,270 --> 00:07:56,330 If the value is below 50, it means that I'm touching the pen. 75 00:07:56,670 --> 00:08:02,880 If it is above 50 means that I'm not touching the pen, we can adjust our code accordingly. 76 00:08:02,940 --> 00:08:04,080 Now, let's do that. 77 00:08:06,020 --> 00:08:16,100 Now, let's go here and add if statement now and that statement, we are going to ask a question, the 78 00:08:16,100 --> 00:08:22,280 value is, above all, equal 50. 79 00:08:24,380 --> 00:08:26,390 And it's more this side, these. 80 00:08:27,590 --> 00:08:32,510 So policy is now in that case, we need to turn on the red. 81 00:08:36,730 --> 00:08:38,500 And Odelay. 82 00:08:41,310 --> 00:08:41,850 Ms. 83 00:08:46,820 --> 00:08:48,680 If the value is. 84 00:08:50,700 --> 00:08:51,720 Below 50, 85 00:08:54,750 --> 00:08:59,190 we need to turn the lid off. 86 00:09:04,710 --> 00:09:07,020 OK, now let's verify our quote. 87 00:09:13,430 --> 00:09:21,340 Oh, and let's print a sentence inside these 12 statements using the serial print. 88 00:09:22,640 --> 00:09:27,110 So here we are going to print lead on. 89 00:09:32,320 --> 00:09:40,390 And here we are going to present a lot of let's vilify the call again. 90 00:09:51,300 --> 00:10:00,390 OK, now let's upload the code to the ISP circuit board again, the process takes some time. 91 00:10:05,210 --> 00:10:07,910 Now it's connecting to the board. 92 00:10:09,650 --> 00:10:11,580 Now it's writing the code. 93 00:10:11,870 --> 00:10:19,640 OK, done uploading now if we open up the serial monitor, as you can see, the light is on and if you 94 00:10:20,450 --> 00:10:23,720 take a look at your board, you can see that the lid is on. 95 00:10:25,420 --> 00:10:33,910 Now, let me touch the touch pen, as you can see, the value goes below 50 and the lid is off. 96 00:10:38,070 --> 00:10:38,740 That's it. 97 00:10:39,030 --> 00:10:46,810 This is how easily you can use and adjust the touch sensor inside the E.S.P 32 ball. 98 00:10:46,950 --> 00:10:53,460 It's built in so you don't have to connect any extra components. 99 00:10:53,700 --> 00:10:58,340 This is how amazing it is and how easy it is to deal with this ball. 100 00:10:58,650 --> 00:11:00,730 If you have any questions regarding this pin. 101 00:11:01,200 --> 00:11:02,250 I'm here to help you. 102 00:11:02,820 --> 00:11:03,120 Thanks. 103 00:11:03,140 --> 00:11:03,600 Watching this. 104 00:11:03,610 --> 00:11:06,390 Listen, this is from educational engineering team.