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

ESP8266 powering

Yes, it would suffice, but using virtual pins gives much more control, and in my opinion more reliability.
If the button is attached to V1 then when you press the button it triggers the BLYNK_WRITE(V1) callback function.
You can then do a digitalWrite to the physical pin you want to control. You also need to declare the pin as output in your void setup.

Pete.

One thing about timers. I want to make the LCD widget display some info. Then 4 seconds later clear and display a second lot of info, then clear again and display a third and then a fourth.

Is there an easy way to do that?

Yes, using a BlynkTimer with an interval of 4 seconds (4000ms) to call a function which clears the LCD and re-displays the new data.

Pete.

Do you mean as in set a timer for 4000 for one lot of info, another for 8000 for the second, then 12000 and so on?

No, you declare one interval timer in your void setup. The function that is named in that timer declaration will be called automatically at the interval defined in declaration (4000 ms in your case).

Post some of your code if you’re struggling with the structure.

Pete.

#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
/
char auth[] = "YourAuthToken";
BlynkTimer timer;

void lcdprinttimer()
{
  if (screen==1)
	{print screen1 to LCD //would obvs be more code here woth the clear screen and actually message to ptint   
		screen++}
	else 
  if (screen==2)
	{print screen2 to LCD
		screen++}
	else
  if (screen==3)
	{print screen3 to LCD
		screen++}
	else
  if (screen==4)
	{print screen4 to LCD
		screen=0}
}
void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth);

  timer.setInterval(4000l, lcdprinttimer);
}
void loop()
{
  Blynk.run();
  timer.run(); 
}

Like this maybe. But I obviously the app button will send screen=1 so the process starts working it’s way through and then shuts off when it gets changed back to 0?

@stevelondon 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:
```

You’ll also need to remove the blockquotes (>) that you’ve used when you posted the code.

Pete.

I’m sorry. Was posting on my mobile on the underground. I’ll try and change it now.

Yes, this approach would work.
Do you need to take some readings to display on the LCD?
If so then maybe do this at the beginning of your lcdprinttimer function.
You could also write the data to Blynk with a virtualWrite in the same function.

Pete.

Basically I just want to confirm that the times and dosages that I input on blink, or actually saved to the board. So by pressing the button, the values I want displayed on the LCD screen will come directly from the board and not from Blynk. Just on the off chance that what I put on the app doesn’t get saved to the board. If these things dose too much, it can wipe out and kill the whole Fish Tank.

1 Like