Hi,
i want to display data from my Wemos D1 into the Terminal widget window every time i push button in the app, so the trigger is from a virtual pin. But i got really difficult to make it shown right. When i push the button, the word comes many time on the window. As using delay will make this worst, i tried to use millis(); like Dmitriy said on this page : What to use instead of Delay() function for Arduino sketch?.
but still the outcome wasn’t better. So i tried to use simple time library like so :
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
WidgetTerminal terminal(V6);
const char* ssid = "FRITZ!Box 7330 SL"; //!!!!!!!!!!!!!!!!!!!!! modify this
const char* password = "xxxxxxxxxxxxxxxxxxxxx"; //!!!!!!!!!!!!!!!!!!!!!modify this
char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxx";
SimpleTimer timer;
int button ;
void setup() {
//Serial.begin(9600);
Blynk.begin(auth,ssid,password);
}
BLYNK_WRITE(V3) { // button in the app, V3
button = param.asInt();
}
void callback()
{
terminal.println("please help me to put this text in the right way");
}
void loop() {
Blynk.run();
timer.run(); // Initiates SimpleTimer
if (button == HIGH){
timer.setTimeout(750, callback); // i already tried different delay time
}
}
I also changed timer.setTimeout(750, callback);
into restartTimer(timer.setTimeout(750, callback)) ;
so the timer will be always restarted as long as the button is pressed. But the output is still so strange
Thank you!