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

To read Numeric input value from loop

Hi blynkers,

I need your help. i can read value on arduino when i send to numeric input value from blynk application. (IOS)

I write to the buttom on void setup. not a loop , everything is right. But i need this value in a loop. i try timer function but i failed. I read continuously “0” in a loop but i can read the value in the code below . I hope we can solve my problem , thanks in advance.

void setup(void)
{...}
BLYNK_WRITE(V35) {
  int programmobil = param.asInt();
  Serial.print(programmobil);
}
void loop(void)
{...}

=> i need to read “programmobil value” in a loop function. ( it is always 0 ). I am not asking why value is 0 , question is how we can read this value in a loop.

@Halilibrahim58 please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

1 Like

If you declare the variable programmobil outside of a function (void) then it will be available globally.
By declaring the variable within a function, it’s value remains local to that function.

Research variable scope and you’ll learn more.

Pete.

Can you explain through an example ?

Too lazy to search?

Pete.

Thank you for your help.

Wrong code:

void setup(void)
{...}
BLYNK_WRITE(V35) {
  int programmobil = param.asInt();
  Serial.print(programmobil);
}
void loop(void)
{...}

True code:

int programmobil;
void setup(void)
{...}
BLYNK_WRITE(V35) {
   programmobil = param.asInt();
  Serial.print(programmobil);
}
void loop(void)
{...}