Problem with this sketch

Hi everyone, I'm a new member and I need the help of someone who know better than me arduino. I've write this sketch but There's a problem when I verify it, but I don't know what is the problem. Can someone help me pleasee :confused:
this is the sketch

master.ino (6.29 KB)

why don't you give us the error directly ? (copy and paste, not an image)


your code has a line

#include <ESP8266TelegramBOT.h>

and you did not give us that file...

Yes the error is this:

exit status 1
expected ';' before 'String'

and this is the file

ESP8266TelegramBOT.cpp (9.1 KB)

ESP8266TelegramBOT.h (1.69 KB)

sts="umidità terreno:; "+String((int)mes_status[0])+"% %A0"+"umidità aria: "+String((int)mes_status[1])+"% %A0"+"temperatura :"String((int)mes_status[2])+"% %A0"+"Stato delle funzioni: %A0"+m1+"%A0"+m2+"%A0"+m3+"%A0"+m4 ;

or more precisely:

...+"temperatura :"String((int)mes_status[2])+...

something missing there... Can you find it?

Sorry but I don't understand you,What do you want to know?And what missing ?

aleefana:
Sorry but I don't understand you,What do you want to know?And what missing ?

I don't want to know anything...

how do you properly conCatenate a String? you are doing it properly in the rest of that line of code.

to be a bit more obvious....

...+"temperatura :[color=red]"S[/color]tring((int)mes_status[2])+...

So how would be the code to work? Because I don't understand well what i have to do... :confused:

aleefana:
So how would be the code to work? Because I don't understand well what i have to do... :confused:

You need to look carefully. You have a line which uses the + operator to put together a bunch of Strings ( a recipe for a program crash but we can get to that later). Look at that line that they've pulled out for you. The error is there and it's damn simple. You don't need to be able to understand anything about code to spot it. You just need to slow down and look CAREFULLY.

if a is a String initialized with "Hello"
if b is a String initialized with " World"

then a [color=blue]+[/color] b is the String "Hello World"

I've correct what you 've said to me but ide send to me always the same error,these is the string correct

sts="umidità terreno:; "+String((int)mes_status[0])+"% %A0"+"umidità aria: "+String((int)mes_status[1])+"% %A0"+"temperatura :" String((int)mes_status[2])+"% %A0"+"Stato delle funzioni:" + "%A0"+m1+"%A0"+m2+"%A0"+m3+"%A0"+m4 ;

your error is STILL THERE:

+"temperatura :" String((int)mes_status[2])+

you are headed for a major face-palm...

what is before String?

Where are the Strings and where are the + between the Strings is the question you need to ask yourself (before asking yourself how to get rid of those completely)

And now It's correct?

sts="umidità terreno:" ; "+String((int)mes_status[0])+"% %A0"+"umidità aria:"+String((int)mes_status[1])"+"% %A0"+"temperatura :" String((int)mes_status[2])"+"% %A0"+"Stato delle funzioni:" + "%A0"+m1+"%A0"+m2+"%A0"+m3+"%A0"+m4 ;

It would really help you if you would get the space bar fixed on the keyboard you are using to write this code. Put some spaces in there so you can see what's going on. Crammingitalltogetherwithnospacesmakesitreallyhardtolookatandread.

Delta_G:
It would really help you if you would get the space bar fixed on the keyboard you are using to write this code. Put some spaces in there so you can see what's going on. Crammingitalltogetherwithnospacesmakesitreallyhardtolookatandread.

and use code tags...

I try to put some space,look it now,and sorry again

sts="umidità terreno:" ; "+String ((int) mes_status[0]) + "% %A0" + "umidità aria: "+String ((int) mes_status[1])" + "% %A0" + "temperatura : " String ((int) mes_status[2]) " + "% %A0" + "Stato delle funzioni:" + "%A0" +m1+ "%A0 "+m2+ "%A0" +m3+ "%A0" +m4 ;

Not just random spaces in random places. Break things up in logical places so you can see each part that is being added together.

here you concatenated correctly:

sts="umidità terreno:" ; "+String ((int) mes_status[0]) +...

here, is where your error is, you've not used the concatenation operator for Strings:

...+ "temperatura : " String ((int) mes_status[2]) " +...

So now it’s correct?

sts="umidità terreno:" ; "+String ((int) mes_status[0]) + "% %A0" + "umidità aria: "+String ((int) mes_status[1])" + "% %A0" + "temperatura : "+ String ((int) mes_status[2]) " + "% %A0" + "Stato delle funzioni:" + "%A0" +m1+ "%A0 "+m2+ "%A0" +m3+ "%A0" +m4 ;