Add Value to Notification

I am trying to send a light value from analog sensor to be displayed with my iOS notification. I try this code but get errors. I cant get it to work, only the normal notification without the lightVal.

I would greatly appreciate the help.
Thank you

 if (lightVal > 600 ) {
    led1.setColor(BLYNK_GREEN);
    led1.on();
    if ( lightVal > 300 && lightflag == true ) {  /// Bright lights? Say so

      lightflag = false;
      Blynk.notify("Current Lumens" + lightVal);
      terminal.println("Lights are on");
      Serial.println("Lights on");
      Serial.println("-------------");
      Serial.println("-------------");
    }  
  }

  else  {
    lightflag = true;
  }

What errors do you get? Does this work in terminal? ("Current Lumens" + lightVal)

I’m guessing that the string isn’t formatted correctly.

You have to change to

Blynk.notify("Current Lumens" + String(lightVal));

or for 1 decimal place

Blynk.notify("Current Lumens" + String(lightVal, 1));

Another point is in

if ( lightVal > 300 && lightflag == true )

lightVal > 300 is redundant as it is always true : lightVal > 600

So that if as the same as

if (lightflag == true )
2 Likes

Thank you for your input, your first code suggestion worked great.