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