help with variable needed


I’ve searched and can’t seem to figure out how to pass information from my variable: GarageOpenMinutes in the body of my email. I have the Blynk.notify working correctly, but can’t figure out the syntax for Basically, I’d like to somehow send the number stored in GarageOpenMinutes to the body of an email.

One of the strings I’ve tried is below. The body of the text in the email is “rage open for:” Which I believe has something to do with I’m asking to be notified after 2 minutes if it is open. It seems to be deleting the “Ga” from “Garage” when 2 minutes pass instead of showing the number “2”.

Blynk.notify(String("Garage door is open for: ") + GarageOpenMinutes + String(" minutes"));"", "Garage Open", "Garage open for: ") + GarageOpenMinutes (" minutes"); // send email

Thank you for any help or advice.

Have you tried using the same String("Garage door is open for: ") + GarageOpenMinutes + String(" minutes") inside the

Something like:

String EmailString;
EmailString = "Garage open for: " + String(GarageOpenMinutes) + " minutes";"", "Garage Open", EmailString);
1 Like

Hi Idb,

This worked perfectly, very much appreciated!

On a side note, should I be setting up this EmailString in Setup, or is it ok within the function?

Good practice to declare it in the beginning and that way you can use it in all functions.

1 Like

Depends, if you set it outside any functions it will be a Global Variable which you can use anywhere, but, it will take more memory. It’s not very likely to matter with small things such as these projects, but it could be an issue with larger projectes.

1 Like

Got it, thanks!