New user here checking things out. Everything is working good except trying to use a calibration factor on the analog input. I can’t find an example or figure out how to use “float” on an input. If there is a better way to incorporate a calibration factor please enlighten me.
Compile error is: exit status 1
‘voltage’ is not captured’
Thank You,
John
#include <ThingerESP8266.h>
#include <OneWire.h>
#include <DallasTemperature.h>
// Usual login stuff here::::
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
void setup() {
sensors.begin();
thing.add_wifi(SSID, SSID_PASSWORD);
pinMode(LED_BUILTIN, OUTPUT);
// digital pin control example (i.e. turning on/off a light, a relay, configuring a parameter, etc)
thing["led"] << digitalPin(LED_BUILTIN);
thing["led"] << invertedDigitalPin(LED_BUILTIN);
thing["Temperature"] >> [](pson & out) {
sensors.requestTemperaturesByIndex(0); // Send the command to get temperatures
out = (int) sensors.getTempFByIndex(0);
thing["RSSI"] >> outputValue (WiFi.RSSI());
thing["AC"] >> outputValue(digitalRead(16));
thing["door"] >> outputValue(digitalRead(5));
int analogValue = analogRead(A0); // read the input on analog pin 0, Battery volts
float voltage;
voltage = analogValue * .1; // cal factor
thing["batt"] >> outputValue(voltage); // send to dash or bucket
// thing["batt"] >> outputValue(analogRead(A0)); // works but needs cal factor
};
}
void loop() {
thing.handle();
}