Hi,
How I can create an InfluxDBClient client with parameters stored in the EEPROM?
The concerns is that I don’t now how to load the parameters that there was stored in the EEPROM because I create InfluxDBClient client before setup.
This is a example code:
#include <EEPROM.h>
#include <InfluxDbClient.h>
#include <InfluxDbCloud.h>
#define INFLUXDB_ORG 76
#define INFLUXDB_BUCKET 96
#define INFLUXDB_URL 116
#define INFLUXDB_POINT 146
#define INFLUXDB_TOKEN 166
char influxdb_org[20];
char influxdb_bucket[20];
char influxdb_url[30];
char influxdb_point[20];
char influxdb_token[100];
InfluxDBClient client(influxdb_url, influxdb_org, influxdb_bucket, influxdb_token, InfluxDbCloud2CACert);
Point sensor(influxdb_point);
void setup()
{
Serial.begin(115200);
EEPROM.get(INFLUXDB_DEVICE, influxdb_device);
EEPROM.get(WIFI_SSID, wifi_ssid);
EEPROM.get(WIFI_PASSWORD, wifi_password);
EEPROM.get(INFLUXDB_ORG, influxdb_org);
EEPROM.get(INFLUXDB_BUCKET, influxdb_bucket);
EEPROM.get(INFLUXDB_URL, influxdb_url);
EEPROM.get(INFLUXDB_POINT, influxdb_point);
EEPROM.get(INFLUXDB_TOKEN, influxdb_token);
if(!client.validateConnection())
{
Serial.println(F("**Error de conexion**"));
}
}
void loop() {
// put your main code here, to run repeatedly:
}
Thanks,