void myTimerMail() //16 sec
{
if (sensorAlarm) {
Blynk.email("Subject: Button Logger", "You just pushed the button.");
}
}
timer.setInterval(16000L, myTimerMail);
This code is running well.
How can i include the variable ‘sensorID’ into the mail body?
The next question is: did this timer run automaticaly every 16 cec? or must i call “myTimerMail()” that he send the mail directly by up coming event, because the variable sensorID have only a few seconds the value.
Have the timer a function that the mail will send only one time and when the next event is coming up send the next mail. Or must i handle this in a new function?
You haven’t shared enough of your sketch for us to know where ‘sensorID’ is coming from and whether it’s a local or global variable. Assuming it’s a global variable you can use the method shown in this example:
Hi Pete, thankyo for answer.
yes sensorID is global
yes i let the timer runing in void loop timer.run(); // Initiates BlynkTimer
so i understand, i must build a string with text and variables and than send it in the mail, is this correct?
or is their another way to put a variable value directly in the mail body and i dont know the syntax?