Battery measurement Added

This commit is contained in:
JonatanRek 2020-01-01 00:56:37 +01:00
parent 65e218e47b
commit e1a7b69fee

View File

@ -11,6 +11,7 @@ const char* SERVER_ADRESS = "";
StaticJsonDocument<250> jsonBuffer; StaticJsonDocument<250> jsonBuffer;
String requestJson = ""; String requestJson = "";
ADC_MODE(ADC_VCC);
//Pins //Pins
#define SENZORPIN 12 //12 #define SENZORPIN 12 //12
@ -27,6 +28,9 @@ void setup() {
jsonBuffer["token"] = HW_TOKEN; jsonBuffer["token"] = HW_TOKEN;
jsonBuffer["values"]["door"]["value"] = 0; jsonBuffer["values"]["door"]["value"] = 0;
int batteryVoltage = (ESP.getVcc() + 600) / 1000;
jsonBuffer["values"]["battery"]["value"] = batteryVoltage;
serializeJson(jsonBuffer, requestJson); serializeJson(jsonBuffer, requestJson);
sendHttpRequest(requestJson); sendHttpRequest(requestJson);