void RestDhtApi::dht(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete) { URLPARAM_RESULT rc; char name[32]; char value[32]; //server.httpSuccess("application/json"); server.httpSuccess(); if (type != WebServer::GET) return; if (strlen(url_tail)) { DHT dht; while (strlen(url_tail)) { rc = server.nextURLparam(&url_tail, name, 32, value, 32); String param = String(name); if (param == "pin") { String vl = value; int v = atoi(vl.c_str()); dht.setup(v); dht.getMinimumSamplingPeriod(); double hum = dht.getHumidity(); double tempC = dht.getTemperature(); double tempF = dht.toFahrenheit(tempC); Serial.println(v); Serial.print(dht.getStatusString()); Serial.print(" - "); Serial.print(hum, 1); Serial.print("% - "); Serial.print(tempC, 1); Serial.print("C - "); Serial.print(tempF, 1); Serial.println("F"); } } } }