mirror of
https://github.com/daniviga/bite.git
synced 2024-11-26 14:56:13 +01:00
Update ESP32 and Arduino examples
This commit is contained in:
parent
5ec9fb7a86
commit
af832c44d1
|
@ -55,7 +55,7 @@ struct netConfig {
|
||||||
} config;
|
} config;
|
||||||
|
|
||||||
char serial[9];
|
char serial[9];
|
||||||
const String apiURL = "/api/device/subscribe/";
|
const String dpsURL = "/dps/device/subscribe/";
|
||||||
const String telemetryURL = "/telemetry/";
|
const String telemetryURL = "/telemetry/";
|
||||||
|
|
||||||
void setup(void) {
|
void setup(void) {
|
||||||
|
@ -63,7 +63,7 @@ void setup(void) {
|
||||||
|
|
||||||
analogReference(EXTERNAL);
|
analogReference(EXTERNAL);
|
||||||
|
|
||||||
StaticJsonDocument<20> api;
|
StaticJsonDocument<20> dps;
|
||||||
|
|
||||||
byte mac[6];
|
byte mac[6];
|
||||||
int eeAddress = 0;
|
int eeAddress = 0;
|
||||||
|
@ -110,8 +110,8 @@ void setup(void) {
|
||||||
Serial.println("DEBUG: clock updated via NTP.");
|
Serial.println("DEBUG: clock updated via NTP.");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
api["serial"] = serial;
|
dps["serial"] = serial;
|
||||||
postData(config, apiURL, api);
|
postData(config, dpsURL, dps);
|
||||||
|
|
||||||
telemetry["device"] = serial;
|
telemetry["device"] = serial;
|
||||||
// payload["id"] = serverName;
|
// payload["id"] = serverName;
|
||||||
|
|
|
@ -55,13 +55,13 @@ struct netConfig {
|
||||||
} config;
|
} config;
|
||||||
|
|
||||||
char* serial;
|
char* serial;
|
||||||
const String apiURL = "/api/device/subscribe/";
|
const String dpsURL = "/dps/device/subscribe/";
|
||||||
const String telemetryURL = "/telemetry/";
|
const String telemetryURL = "/telemetry/";
|
||||||
|
|
||||||
void setup(void) {
|
void setup(void) {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
|
||||||
StaticJsonDocument<64> api;
|
StaticJsonDocument<64> dps;
|
||||||
|
|
||||||
preferences.begin("iot");
|
preferences.begin("iot");
|
||||||
// Get the serial number from flash
|
// Get the serial number from flash
|
||||||
|
@ -117,8 +117,8 @@ void setup(void) {
|
||||||
Serial.println("DEBUG: clock updated via NTP.");
|
Serial.println("DEBUG: clock updated via NTP.");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
api["serial"] = serial;
|
dps["serial"] = serial;
|
||||||
postData(config, apiURL, api);
|
postData(config, dpsURL, dps);
|
||||||
|
|
||||||
telemetry["device"] = serial;
|
telemetry["device"] = serial;
|
||||||
// payload["id"] = serverName;
|
// payload["id"] = serverName;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user