Need Help For Numeric Input Widget

i try to use Numeric Input Widget, and set it to V3 virtual pin, but the problem is i cant call the “menit” on void clock display, how to fix this ?
this is my code, hope u help me, thank you from indonesia, sorry for bad english.


BLYNK_WRITE(V3) //input from Numeric Widget
{
  long menit = param[0].asLong();
}
void clockDisplay()
{
  // You can call hour(), minute(), ... at any time
  // Please see Time library examples for details

  String currentTime = String(hour()) + ":" + minute() + ":" + second();
  String currentDate = String(day()) + " " + month() + " " + year();
  Serial.print("Current time: ");
  Serial.print(currentTime);
  Serial.print(" ");
  Serial.print(currentDate);
  Serial.println();
  if(minute() == menit)
  {
    digitalWrite(LED_BUILTIN, HIGH);
  }
  else
  {
    digitalWrite(LED_BUILTIN, LOW);
  }
  // Send time to the App
  Blynk.virtualWrite(V1, currentTime);
  // Send date to the App
  Blynk.virtualWrite(V2, currentDate);
}

You’re declaring the variable menit as a local variable when you put “long” in front of it in this function. That means that the scope of the variable is limited to just that function.

Declare it as a long variable type at the top of your code and it will be available globally within all of your code.

Pete.

1 Like

oh my God, thank you, so simple, thank you sir.