Hardware Reference
In-Depth Information
The Arduino sketch is similar to the one in the previous section, so I will only discuss the
main changes.
In the loop() function of the sketch, you need to set the limit at which the e-mail will be
sent by Temboo. For demonstration purposes, I will set the limit to 23, as shown in the
following code:
if (temperature > 23) {
Serial.println("\nTriggered! Calling /Library/Google/
Gmail/SendEmail...");
// Send email
runSendEmail(temperature);
}
You can see that every time the temperature goes above that limit, an alert will be sent by
Temboo via e-mail. We will see the details of this function in a moment. I also inserted a
1-minute delay between each measurement, so we don't continuously send e-mails if the
threshold is crossed:
delay(60000);
Now let's look at the details of the runSendEmail() function. This function is re-
sponsible for creating the correct Choreo to send an e-mail, set the body of the e-mail, and
send it via Temboo.
It starts by creating the correct Choreo to send an e-mail with the following line:
TembooChoreoSendEmailChoreo(client);
We also define the different information relative to your account that is defined in the
Temboo account file you just downloaded from Temboo:
SendEmailChoreo.setAccountName(TEMBOO_ACCOUNT);
SendEmailChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
SendEmailChoreo.setAppKey(TEMBOO_APP_KEY);
Then, this is where you need to enter the name of the e-mail project that you just created
on Temboo. If you use the same name as I did, there is no need to modify anything in the
following line:
Search WWH ::




Custom Search