Need some help with battery reading. I am monitoring a 12v leisure battery for a greenhouse project. I have connected a 1M ohm resistor in series with pin A0 on the Wemos D1 mini. On the blynk app I have two value displays, one has pin A0 assigned and the other has pin V0 assigned. I have a reading on A0 (raw ADC value) but nothing on V0. Any help would be great. Code below.
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
char auth[] = "***************************************";
char ssid[] = "*************";
char pass[] = "**************";
#define DHTPIN 2
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;
void sendSensor()
{
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
int hAsInt = int(h); // converts to int removing unessisary decimal points
int tAsInt = int(t);
Blynk.virtualWrite(V5, h);
Blynk.virtualWrite(V6, t);
}
// Simple monitoring of internal voltage levels:
void VCCInput() {
//Blynk.virtualWrite(V0, ESP.getVcc() * 0.001);
Blynk.virtualWrite(V0, analogRead(A0)*0.0145); // ADC range up to 14.8v
}
void setup()
{
// Debug console
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
dht.begin();
timer.setInterval(1000L, sendSensor);
}
void loop()
{
Blynk.run();
timer.run();
}