Now that we have sent an email, we can configure this email to include sensor data.
So what we need to do at this point is go back to our code.
Let's save it.
Let's call it called sense of humor.
Now we have this code that we can edit.
What we need to do is to read the touch sensor that is built in our SSP board, you can use that temperature
sensor or any other type of sensor.
Just connect to the right pen.
Now.
The first thing that we need to do is create new variable, just make it integer and let's name it touch
value.
Now, inside this method, we can.
Into the loop and take this variable, which is such value inside the loop.
And make it equal that actually it's function and let's assume that we are using the substance or that
PIN number for now to get the reading letters printed on serum matter cereal that print on.
And let's print out.
The touch sensor value.
No sound, not a quotation.
OK, next, let's add cereal, not plant alone.
And let's pass the touch value.
OK, now that we have the touch value, we can add a condition.
If statement, you can choose the very same thing for temperature sensors or any other type of sensor.
Now let's say if the touch value
is above or equal 100, we need to send us an email and we need to send the message and this email to
be.
Let's go this.
The school this year.
So we need the message to be.
And plaintext.
Now, Sid, the message we need to write to the Dutch since sensor value.
Is above 100 now, we will receive an email stating this after receiving the email Atalay.
Now, let me delay 1000 seconds, then we need to make this, which is basically make sure that we don't
have any errors and.
Add that a second.
Back here.
Now, what will happen here when we receive an email with this message, one essential value is above
100.
You can add a temperature sensor and if the sensor value is above 50, you can receive an email with
an alert to make sure that, you know, there is high temperature in the location and you can check
it out after that.
We are adding the recipient and we are sending the email with the A.P. data and then we are printing
this and the sheer amount of we have an error, then we are emptying that MTBE data.
That's it.
This is how you can send an email to this section of code.
Now, let's test this out to make sure that it works and you can move all of these to the void loop
section.
So let's move them, let's copy all of this.
And pasted above this line.
Here.
Now we have the login details, we have the email, the sender, the priority and the email subject,
we are reading the sense of value and we are printing the same sort of value on the.
So then we are checking if the sensor values are above 100 or equal to 100, then we are sending a message,
an e-mail message.
And let's comment these parts from here.
Add this to comments.
OK, now let's verify the code, then upload it to our people.
I will hook up my board to my ISP.
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
we just connected to, make sure that we are receiving the sensor data.
Now.
As you can see, the court is applauding and the is connecting through com for now, it's uploading
the code to the ISP memory.
Now, done uploading.
That's it.
Now.
We need to make sure that we have.
The censor reading.
Let's check that email to make sure.
OK.
We are receiving an email.
And as you can see, that much sense of value is above 100, and I received the same email on my mobile
phone, so that much sense of value in this case is above 100.
You can also send that sense of value on the email itself.
It will be a very easy thing to do.
But this is the main point, and we have a problem here.
We received over 10 emails.
This is because in our code in the loop, inside the loop function, we only added one thousand one
thousand milliseconds, which is basically one second.
So we will keep receiving emails every second.
We can increase this number to be.
Like 10 or 100 seconds, then we can't upload the code.
OK, now what I did hear is basically I have seen that sentence, the touchstone of value is above 100
plus that adds value.
It will send the touchstone sort of value with the email.
And I added 100 second between every email and the next one.
So let's check to see.
What we did receive.
Now, as you can see here, we are receiving their sense of values, a 99 and we didn't get that line,
which is the first sense of value above 100 because it's not above 100.
That's it.
This is basically how easily you can send census data to our to your email or how to get an email alert
when the value goes above a certain value.
That's it for this lesson.
If you have any questions, please ask in the Q&A board.
And the same approach can be done for them.
Sensorimotor sensor and any other type of sensor.
You can even create a.T.M alcalde that display the sensor reading in a nice way graphical user interface,
using batons, using text colors and other stuff.
Now, again, if you have any questions, you can ask it in the Q&A about this is Ashar from educational
engineering team.