I am stuck because I don't know how exactly everything works.
I want to send a 32 integer to be charted every minute by the ESP32's timer interrupt.
I don't have and array, or a complicated structure, just a lonely word!
On the ESP32 side I have;
Code: Select all
/
***** Declrations
JSONVar readings;
AsyncWebServer server(80);
AsyncEventSource events("/events");
AsyncWebSocket ws("/ws");
/****
String getTicks(){
readings["ticks"] = String(Ticks);
String jsonString = JSON.stringify(readings);
return jsonString;
}
void initWebSocket() {
ws.onEvent(onEvent);
server.addHandler(&ws);
}
// Get Ticks and return JSON object
String getTicks(){
readings["ticks"] = String(Ticks);
String jsonString = JSON.stringify(readings);
return jsonString;
}
/************ under setup
// Request for the latest sensor readings
server.on("/ticks", HTTP_GET, [](AsyncWebServerRequest *request){
String json = getTicks();
request->send(200, "application/json", json);
json = String();
});
server.addHandler(&events);
AsyncElegantOTA.begin(&server);
server.begin();
}
Code: Select all
events.send(String(Ticks).c_str(),"ticks",millis());
I need someone to show me how I can send an integer to a highchart to be displayed as bar graph. I can find a few examples that use an array and deal with Json, but it shouldn't be that evolved.
I don't have enough understanding to decipher the online "manual", with no real examples.
Thanks.