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

Blynk Function Not Working

#1

The param.asInt on V9 is a numeric input widget with a time of 0 - 120min. The idea is to get the info and turn it into millis to be used elsewhere. On the serial monitor it shows a 0 value although on the app the widget has been set to 2min. Can someone please explain why is that?

BLYNK_WRITE(V9)   //CH1 FADEIN TIME WIDGET
{
  FadeIN = param.asInt();
  FadeInTime == (FadeIN * 60000);   //Param is in minutes
  //FadeInTime = map(FadeIN, 0, 120, 0, 7200000);    //2 hour max fade duration
  Serial.print("LedFadeIn Time: ");
  Serial.println(FadeInTime);
}
0 Likes

#2

Is fadeInTime an int? If so try making it a long.

Failing that post all your code using 3 backtsticks at per forum rules and we can have a look.

But I think the problem is the variable isn’t big enough to hold your number.

0 Likes

#3

Integers are sufficient for your ranges.

But you are using the Comparison Operator == when you should be using the Arithmetic Operator (Equal/Assignment operator) =

1 Like

#4

Ah yes, cheers @Gunner, I was thinking of IEC61131 (PLC) for a moment there where ints are ffectively shorts in C++

0 Likes

#5

@Gunner thanks that worked.

1 Like