Hello
Can you please tell me why in the program the LCD flickers
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Fishino.h>
#include <BlynkSimpleFishino.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "80a7c4faf7c4258";
WidgetLCD lcd(V0);
WidgetLED led0(V1);
WidgetLED led1(V2);
char ssid[] = "ich";
char pass[] = "98312623";
bool enableTimer = true;
bool enableTimer1 = true;
BLYNK_WRITE(V3) // Timer enable/disable
{
int setting = param.asInt();
enableTimer = setting;
}
BLYNK_WRITE(V4) // Timer enable/disable
{
int setting = param.asInt();
enableTimer1 = setting;
}
void checkTimer()
{
if((enableTimer == 1) && (enableTimer1 == 1))
{
// Timer is running, so lights on!
digitalWrite(6, HIGH);
led0.on();
led1.off();
lcd.print (0,1,"LED ist ON");
}
else
{
lcd.clear();
digitalWrite(6, LOW);
led0.off();
led1.on();
lcd.print (0,1,"LED ist OFF");
}
}
void setup()
{
// Debug console
Serial.begin(9600);
pinMode(6, OUTPUT);
lcd.print (0,0,"LED ist OFF");
Blynk.begin(auth, ssid, pass);
}
void loop()
{
Blynk.run();
checkTimer();
}
1/ you have your checktimer in the main loop
better use blynk timer
2/ in your checktimer you have a lcd.clear.
@markop As you are not new to this forum, you should remember to search this forum for past issues/solutions before posting questions…
Not to mention Google… as this LCD “flickering” issue is exactly the same cause and solution with both the virtual and physical LCD.
http://forum.arduino.cc/index.php?topic=317918.0
1 Like
I’ve done it a little bit differently so it works without flickering
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Fishino.h>
#include <BlynkSimpleFishino.h>
#include <TimeLib.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "58";
WidgetLCD lcd(V0);
WidgetLED led0(V1);
WidgetLED led1(V2);
char ssid[] = "ich";
char pass[] = "3";
bool enableTimer = true;
bool enableTimer1 = true;
BlynkTimer timer;
BLYNK_WRITE(V3) // Timer enable/disable
{
int setting = param.asInt();
enableTimer = setting;
}
BLYNK_WRITE(V4) // Timer enable/disable
{
int setting = param.asInt();
enableTimer1 = setting;
}
void checkTimer()
{
if((enableTimer == 1) && (enableTimer1 == 1))
{
// Timer is running, so lights on!
digitalWrite(6, HIGH);
led0.on();
led1.off();
lcd.print (0,1," LED ist ON ");
}
else
{
lcd.print (0,0,"LED Notschalter");
digitalWrite(6, LOW);
led0.off();
led1.on();
lcd.print (0,1," LED ist OFF");
}
}
void setup()
{
Serial.begin(9600);
pinMode(6, OUTPUT);
digitalWrite(6, LOW);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
Blynk.run();
checkTimer();
}
you will flood Blynk for sure
2 Likes