I think your syntaxis is incorrect: http://docs.blynk.cc/#blynk-firmware-configuration-blynkconfig
Oh right, he is also using Wifi authentication in that line. Does that make a difference?.. ESPāsā¦ I know very little about them.
@willerpw the syntax for Blynk.config() only takes auth, plus server and port, if not using Blynkās cloud server.
To use Blynk.config() you have to first make a regular WiFi connection.
Also in loop() it is expected that you use something like this:
if(Blynk.connected()){
Blynk.run();
}
OK, I think you then need these lines: (again, I am guessing a bit hereā¦ test and compare with the documents and other examples)
Blynk.connectWiFi(ssid, pass);
Blynk.config(auth); // or Blynk.config(auth, wifi); ??
Then for the main loop:
void loop()
{
if(Blynk.connected()) {
Blynk.run();
}
timer.run(); // Initiates SimpleTimer
}
From what I can tell it seems like your device might need some time to ābootā in order to give proper and fast readings.
āLike you mentioned, I saw some strange calculations for the run-time at the beginning of the loops (i.e. up to 3 seconds to complete instead of 175ms). This generally lasts about 1 min and then evens outā
Src: https://openenergymonitor.org/forum-archive/node/2669.html
@willerpw now that you have worked out what the PushData example does you can remove all reference to it (i.e. myTimerEvent() function and the call in setup()). You just need the energy() stuff.
As the code is currently written the LCD will not be updated when you are not connected to Blynk. There are ways to overcome this but really you should work out why you are being disconnected from Blynk.
As you have seen with PushData, Blynk is rock solid if you your code is well written.
@Costas definetly. Im busy implementing all of you guys ideas. Will update you when I get it sorted or when I reach a brick wall.
Really greatful for all your help so far.
Chiming in as Iām also using EmonLib with some cheap 5A CTs (to a WeMos pin A0).
I had a similar issue as @willerpw with any emon1.calc
function running at a frequency greater than 1 second. In my case it is emon1.calcIrms(1480);
ā¦ meaning that 1,480 current samples are taken (source)! Of course putting this in loop()
was no good, 500ms was shaky, 1 sec decent, 5 sec just fine. I should note this wasnāt just affecting my Blynk connection, this was affecting the ESPās WiFi connection (from what I could tell pinging, etc).
I only picked up on this because I was trying to trigger a notification on a very short (< 1 sec) current blip, then noticed my OTA updates werenāt working. Iām going to try tweaking the number of samples vs. frequency and see what I get.