1 00:00:02,490 --> 00:00:08,110 Now that we have sent an email, we can configure this email to include sensor data. 2 00:00:08,850 --> 00:00:12,450 So what we need to do at this point is go back to our code. 3 00:00:13,730 --> 00:00:14,730 Let's save it. 4 00:00:16,930 --> 00:00:20,550 Let's call it called sense of humor. 5 00:00:22,330 --> 00:00:24,970 Now we have this code that we can edit. 6 00:00:26,650 --> 00:00:33,670 What we need to do is to read the touch sensor that is built in our SSP board, you can use that temperature 7 00:00:33,670 --> 00:00:36,100 sensor or any other type of sensor. 8 00:00:36,100 --> 00:00:37,810 Just connect to the right pen. 9 00:00:38,530 --> 00:00:39,040 Now. 10 00:00:41,440 --> 00:00:49,150 The first thing that we need to do is create new variable, just make it integer and let's name it touch 11 00:00:49,150 --> 00:00:49,670 value. 12 00:00:51,190 --> 00:00:57,310 Now, inside this method, we can. 13 00:00:59,390 --> 00:01:07,030 Into the loop and take this variable, which is such value inside the loop. 14 00:01:08,950 --> 00:01:16,470 And make it equal that actually it's function and let's assume that we are using the substance or that 15 00:01:16,480 --> 00:01:25,620 PIN number for now to get the reading letters printed on serum matter cereal that print on. 16 00:01:28,100 --> 00:01:30,260 And let's print out. 17 00:01:33,930 --> 00:01:38,210 The touch sensor value. 18 00:01:42,850 --> 00:01:44,890 No sound, not a quotation. 19 00:01:44,980 --> 00:01:51,160 OK, next, let's add cereal, not plant alone. 20 00:01:53,480 --> 00:01:55,830 And let's pass the touch value. 21 00:01:58,460 --> 00:02:02,360 OK, now that we have the touch value, we can add a condition. 22 00:02:03,670 --> 00:02:13,090 If statement, you can choose the very same thing for temperature sensors or any other type of sensor. 23 00:02:13,540 --> 00:02:15,880 Now let's say if the touch value 24 00:02:18,490 --> 00:02:28,660 is above or equal 100, we need to send us an email and we need to send the message and this email to 25 00:02:28,660 --> 00:02:29,110 be. 26 00:02:30,650 --> 00:02:32,540 Let's go this. 27 00:02:34,820 --> 00:02:35,960 The school this year. 28 00:02:38,140 --> 00:02:40,750 So we need the message to be. 29 00:02:43,620 --> 00:02:44,880 And plaintext. 30 00:02:55,310 --> 00:03:04,610 Now, Sid, the message we need to write to the Dutch since sensor value. 31 00:03:06,670 --> 00:03:16,830 Is above 100 now, we will receive an email stating this after receiving the email Atalay. 32 00:03:23,060 --> 00:03:32,420 Now, let me delay 1000 seconds, then we need to make this, which is basically make sure that we don't 33 00:03:32,420 --> 00:03:34,670 have any errors and. 34 00:03:36,200 --> 00:03:39,320 Add that a second. 35 00:03:43,070 --> 00:03:43,850 Back here. 36 00:03:49,320 --> 00:03:54,350 Now, what will happen here when we receive an email with this message, one essential value is above 37 00:03:54,350 --> 00:03:54,900 100. 38 00:03:55,200 --> 00:04:02,040 You can add a temperature sensor and if the sensor value is above 50, you can receive an email with 39 00:04:02,040 --> 00:04:07,470 an alert to make sure that, you know, there is high temperature in the location and you can check 40 00:04:07,470 --> 00:04:09,340 it out after that. 41 00:04:09,360 --> 00:04:19,350 We are adding the recipient and we are sending the email with the A.P. data and then we are printing 42 00:04:19,740 --> 00:04:25,710 this and the sheer amount of we have an error, then we are emptying that MTBE data. 43 00:04:26,400 --> 00:04:27,010 That's it. 44 00:04:27,360 --> 00:04:32,760 This is how you can send an email to this section of code. 45 00:04:35,280 --> 00:04:42,030 Now, let's test this out to make sure that it works and you can move all of these to the void loop 46 00:04:42,030 --> 00:04:42,570 section. 47 00:04:44,300 --> 00:04:47,090 So let's move them, let's copy all of this. 48 00:04:48,180 --> 00:04:52,560 And pasted above this line. 49 00:04:53,640 --> 00:04:54,180 Here. 50 00:04:57,620 --> 00:05:04,400 Now we have the login details, we have the email, the sender, the priority and the email subject, 51 00:05:04,820 --> 00:05:09,560 we are reading the sense of value and we are printing the same sort of value on the. 52 00:05:10,130 --> 00:05:17,930 So then we are checking if the sensor values are above 100 or equal to 100, then we are sending a message, 53 00:05:18,560 --> 00:05:19,580 an e-mail message. 54 00:05:19,700 --> 00:05:23,170 And let's comment these parts from here. 55 00:05:24,350 --> 00:05:27,240 Add this to comments. 56 00:05:27,860 --> 00:05:32,770 OK, now let's verify the code, then upload it to our people. 57 00:05:34,010 --> 00:05:36,920 I will hook up my board to my ISP. 58 00:05:39,840 --> 00:05:49,290 OK, now the ISP is hooked up now let's move on to now let's upload our code to the E.S.P board that 59 00:05:49,290 --> 00:05:54,460 we just connected to, make sure that we are receiving the sensor data. 60 00:05:55,320 --> 00:05:55,830 Now. 61 00:05:57,250 --> 00:06:05,800 As you can see, the court is applauding and the is connecting through com for now, it's uploading 62 00:06:05,800 --> 00:06:09,010 the code to the ISP memory. 63 00:06:11,410 --> 00:06:12,800 Now, done uploading. 64 00:06:13,090 --> 00:06:13,740 That's it. 65 00:06:14,930 --> 00:06:15,440 Now. 66 00:06:16,840 --> 00:06:18,940 We need to make sure that we have. 67 00:06:20,010 --> 00:06:21,330 The censor reading. 68 00:06:23,310 --> 00:06:25,580 Let's check that email to make sure. 69 00:06:27,380 --> 00:06:27,880 OK. 70 00:06:29,130 --> 00:06:30,990 We are receiving an email. 71 00:06:33,680 --> 00:06:39,650 And as you can see, that much sense of value is above 100, and I received the same email on my mobile 72 00:06:39,650 --> 00:06:43,610 phone, so that much sense of value in this case is above 100. 73 00:06:43,940 --> 00:06:47,720 You can also send that sense of value on the email itself. 74 00:06:48,950 --> 00:06:51,380 It will be a very easy thing to do. 75 00:06:52,280 --> 00:06:55,430 But this is the main point, and we have a problem here. 76 00:06:55,460 --> 00:06:57,170 We received over 10 emails. 77 00:06:57,920 --> 00:07:06,550 This is because in our code in the loop, inside the loop function, we only added one thousand one 78 00:07:06,560 --> 00:07:08,770 thousand milliseconds, which is basically one second. 79 00:07:09,050 --> 00:07:11,850 So we will keep receiving emails every second. 80 00:07:12,590 --> 00:07:14,480 We can increase this number to be. 81 00:07:16,090 --> 00:07:20,230 Like 10 or 100 seconds, then we can't upload the code. 82 00:07:22,150 --> 00:07:29,950 OK, now what I did hear is basically I have seen that sentence, the touchstone of value is above 100 83 00:07:30,460 --> 00:07:32,050 plus that adds value. 84 00:07:32,050 --> 00:07:35,040 It will send the touchstone sort of value with the email. 85 00:07:36,010 --> 00:07:42,450 And I added 100 second between every email and the next one. 86 00:07:43,090 --> 00:07:45,910 So let's check to see. 87 00:07:47,290 --> 00:07:48,610 What we did receive. 88 00:07:53,380 --> 00:08:01,300 Now, as you can see here, we are receiving their sense of values, a 99 and we didn't get that line, 89 00:08:01,300 --> 00:08:06,450 which is the first sense of value above 100 because it's not above 100. 90 00:08:07,600 --> 00:08:08,390 That's it. 91 00:08:08,440 --> 00:08:16,420 This is basically how easily you can send census data to our to your email or how to get an email alert 92 00:08:16,420 --> 00:08:19,470 when the value goes above a certain value. 93 00:08:20,560 --> 00:08:21,530 That's it for this lesson. 94 00:08:21,580 --> 00:08:24,250 If you have any questions, please ask in the Q&A board. 95 00:08:24,850 --> 00:08:28,720 And the same approach can be done for them. 96 00:08:28,960 --> 00:08:32,080 Sensorimotor sensor and any other type of sensor. 97 00:08:32,380 --> 00:08:40,450 You can even create a.T.M alcalde that display the sensor reading in a nice way graphical user interface, 98 00:08:40,930 --> 00:08:44,590 using batons, using text colors and other stuff. 99 00:08:46,510 --> 00:08:52,270 Now, again, if you have any questions, you can ask it in the Q&A about this is Ashar from educational 100 00:08:52,270 --> 00:08:53,080 engineering team.