Pull Multiple Text Boxes on Button Push

Hardware: ESP32
Blynk server
Blynk Library version: 0.6.1

Hello everyone,

I have a ePaper screen that I want to use a meal planner. I have the 7 days of the week and the meals are 7 text boxes that Blynk will send to the ESP32 and display them on the epaper screen.

At the moment every time you finish a text box it calls a function and updates the screen.

BLYNK_WRITE(V1) // Monday textbox is on V1 for example
{
  int monText = param.asStr(); // assigning incoming value from pin V1 to a variable

}

BLYNK_WRITE(V2) // Monday textbox is on V2 for example
{
  int tueText = param.asStr(); // assigning incoming value from pin V1 to a variable

}

...etc

This works, but is kind of annoying when you have to update 7 things at once.

I am searching for a way to pull all text boxes when you press a virtual button on a vpin. I cannot find anything via Googling or searching on this forum.

Any help would be appreciated or if you have a suggestion on a better way to do it, that would be great also.

You’re storing the text as an integer???

If you want to cause BLYNK_WRITE(V1), BLYNK_WRITE(V2) etc to execute on the push of a button (let’s say one attached to pin V8) then do this…

BLYNK_WRITE(V8)
{
  Blynk.syncVirtual(V1);
  Blynk.syncVirtual(V2);
 
  Ditto...
  
  Blynk.syncVirtual(V7);
}

Pete.

No, it’s a typo :sweat_smile:

Thanks, I think I was missing Blynk.syncVirtual. I’ll give it a shot

Just another questions, so I make sure I understand. I want to grab the text data for each text box and store them in a variable. So how does that work with the Blynk.syncVirtual?

I make functions for each virtual pin the text boxes are on? Then in the button function I assign a string for each Blynk.syncVirtual?

BLYNK_WRITE(V8)
{
  String monText = Blynk.syncVirtual(V1);
  String tueText = Blynk.syncVirtual(V2);

}

BLYNK_WRITE(V1)
{
String monText = param.asStr();
return monText;
}

BLYNK_WRITE(V2)
{
String tueText = param.asStr();
return tueText;
}

You can’t invent syntax like this!

Blynk.syncVirtual(vPin) causes the corresponding BLYNK_WRITE(vPin) callback to ‘fire’, simulating the user clicking the widget in the app.

Which is why I said…

Pete.

Thanks for the reply again.

I’ve give it a try later today.