I,m a total beginner with iot Cloud and i just want to display voltage measured with my Wemos D1 Mini (ESP8266). I have connected 1.44Mohm resistor between analog A0 and my car battery and i can get the code to work in Serial monitor, but i just can,t understand how i can display the voltage in Arduino cloud dashboard.
The code compiles and i have tried alot, but no voltage is displaying.
Here is my code:
int vPin = A0;
int measuredVoltage;
#include "thingProperties.h"
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
pinMode(vPin, INPUT);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
}
void loop() {
ArduinoCloud.update();
int realVoltage = analogRead(vPin);
int measuredVoltage = (15.3 / 1023) * realVoltage;
/*battery_Monitor = analogRead(realVoltage); */
Serial.println(realVoltage);
}