sketch compilation problem for ESP8266

Simple project:

  • a water meter with a reed relay that emits one pulse every 10 liters
  • an ESP8266 card programmed to record the clicks and send an email every m3 of water


  • realized the sketch that feels the impulse and increases the counters, transferred to the ESP8266 (attached file contalitri_1.ino): it works
  • realized the sketch that sends the email, transferred to the ESP8266 (attached file invioEmail_1.ino): it works, I receive the email
  • put together the two codes in a single sketch (attached file contalitri_e_mail_1.ino): I can’t get past the sketch compilation phase and I don’t understand what the error is.
    Can someone help me?
    Thank you
    Antonio Mezzacapa
    Invia commenti

contalitri_1.ino (1.27 KB)

invioEmail_1.ino (3.51 KB)

contalitri_e_mail_1.ino (4.72 KB)

I don't even know what the error is. I am guessing that the error is on line 165 of the *.ino file.

If you ctrl-t you will find that there are closing braces missing i hit an error first on line 71, adding one for the statement after the if statement and one to complete the function. Hit ctrl-t again and i found an extra one at the end of the code, removed that, still got a bunch of warnings, but it compiles.

Hi. Thank you for your attention.
May I ask you to correct the code here attached and send back to me?
I did what you said but without results
Thanks again

Sorry, maybe I forgot the attachment

contalitri_e_mail_1.ino (4.92 KB)

Sorry, maybe I forgot the attachment

You have forgotten a lot more than that.

After doing the Auto Format, you forgot to go through your code and make sure that all functions, like sendEmail() start in column 1.

That function does NOT, which means that it is defined inside of another function, which is NOT allowed.

You have also completely forgotten what you can, and can not, do in an interrupt service routine.

You can completely forget about send an email from an interrupt service routine.