Hello,
I’am working on a project with an ESP8266 and a Nova PM SDS011 sensor. All the data that I collect goes to an API through a local Blynk server.
void sendData(double z, double k, int a, int b, int c)
{
StaticJsonBuffer<200> jsonBuffer;
JsonObject &root = jsonBuffer.createObject();
String string_a = String(a, 2);
String string_b = String(b, 2);
String string_c = String(c, 2);
String string_z = String(z, 2);
String string_k = String(k, 2);
root["device"] = device_name;
root["PM2_5"] = string_z;
root["PM10"] = string_k;
root["mixed_feeling"] = string_b;
root["negative_feeling"] = string_c;
root["positive_feeling"] = string_a;
root["longitude"] = string_lat;
root["latitude"] = string_lng;
root.printTo(Serial);
char JSONmessageBuffer[300];
root.prettyPrintTo(JSONmessageBuffer, sizeof(JSONmessageBuffer));
Serial.println(JSONmessageBuffer);
if (WiFi.status() == WL_CONNECTED)
{ //Check WiFi connection status
HTTPClient http; //Declare object of class HTTPClient
http.begin("APIURL"); //Specify request destination
http.addHeader("Content-Type", "application/json"); //Specify content-type header
int httpCode = http.POST(JSONmessageBuffer); //Send the request
String payload = http.getString(); //Get the response payload
Serial.println(httpCode); //Print HTTP return code
Serial.println(payload); //Print request response payload
http.end(); //Close connection
}
else
{
delay(500);
strip.setPixelColor(0, strip.Color(255, 200, 0)); //Orange
strip.show();
delay(500);
strip.setPixelColor(0, strip.Color(30, 144, 255)); //Blue
strip.show();
}
}
All the data are sent by either the Nova PM or the GPS stream widget.
What I would like to do is to add in my iOS app, 3 buttons to populate the positive feeling, mixed feeling and negative feeling of my database which can be populate with a number. For now it is always on 0 but would like to add a 1 if I press on the push button of my app.
Do you know if there is a way to do that, I guess so but cannot find…
Thank you