How to retrieve/store data from slider widget

Hi all,

As Blynk Docs reports BLYNK.WRITE(Vx) cannot be inside another function.
The command:
int pinValue = param.asInt(); assigns incoming value from pin Vx to a variable that become available for Serial commands such as Serial.print. Easy to undertand and get output results on serial monitor.
But, how to use the value of this variable in other parts of my code?
Is there a way/command to do that? Specially inside another function? I searched many other Serial commands but no one match what I need.
When I try to do that, for instance comparing one variable to another (Example: if (anotherValue >pinValue){) the error message is: ‘pinValue’ was not declared in this scope.
Please, help me on that to finish my project.


Tks Pavel,
Even been a beginner I know what global and local variables are.
I thought even afer BLYNK.WRITE variables were considered as Global. But not.
What I did was:
Create a new Global before BLYNK.WRITE like this and it worked.

int slider;

int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable

Please consider this topic closed.



int slider;

slider = param.asInt(); // assigning incoming value from pin V1 to a variable


Then you know not necessary to use both at the same time :wink:

Opps, I see @Toro_Blanco already showed the correct way to do it :blush:

1 Like

You are totally right!!
Tks all!!