BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Compiling Error on Blynk.notify()


#1

When I tried to compile my code, the error message:

error: invalid operands of types 'const char [36]' and 'float' to binary 'operator+'

Blynk.notify("Your car's current temperature is: " + avgTemp + "°F, your veggies will go bad in 40 minutes. It will take approximately " + t + " minutes to walk back to your car.");

due to the following code segment:

 if(showInfo){
    Blynk.notify("Your car's current temperature is: " + avgTemp + "°F, your veggies will go bad in 40 minutes. It will take approximately" + t + " minutes to walk back to your car.");
    showInfo = false;             
  }

Can anyone give me a hint on how to solve this?


#2

@Darre_Lau use String(avgTemp) and if that doesn’t work String everything else.

Syntax for 3 dp would be String(avgTemp, 3)

Same with variable t.


#3

That work, thanks!


#4

Hi @Darre_Lau ,

I have the same question but I don’t understand what the solution was. do you still have this section of code that I can see how you did it? Thanks