Good day i am a newbie here… i am trying to create a project where a current meter(break out Board) reads current and this can be visible on Blynk App widget…
from multiple experiments it seems as though Bylnk is interfereng with the emon lib function and not producing a reading as when i do not include Blynk code it works fine and produces accurate readings…as soon as i try to include this in a Blynk sketch not even in the serial monitor am i getting readings and just getting 0 in Serial monitor…i know the program is calling the function and printing “a” (done purposely as a test) in the serial monitor but no readings are being taken …
Below is a very simple version of the sketch as even this is not working…if anyone can shed some light as to why this is happening please let me know…ps i have tried other sketches in Blynk and they work fine like taking and sending temperature readings and other sensors etc…my concern to begin with is why are no readings being taken in the serial monitor first and foremost when without the Blynk code they where (so not an issue of pins,wiring or sensor malfunction)…meanwhile i will continue to experiment but f anyone spots something i am unaware of please let me know
#define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID ""
#define BLYNK_TEMPLATE_NAME ""
#define BLYNK_AUTH_TOKEN ""
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include "EmonLib.h"
EnergyMonitor emon1;
char ssid[] = "";
char pass[] = "";
BlynkTimer timer;
void setup()
{
Serial.begin(9600);
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
emon1.current(13, 1.72);
timer.setInterval(3000L, myTimer);
}
void myTimer()
{
double Irms = emon1.calcIrms(1480);
Serial.print(Irms*230.0);
Serial.print("a ");
Serial.println(Irms);
Blynk.virtualWrite(V5, Irms);
}
void loop(){
Blynk.run();
timer.run();
}