Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //attempt to connect to wifi
- float h = dht.readHumidity();
- float t = dht.readTemperature();
- String t1=String(t);
- Serial.println(h);
- Serial.println(t1);
- if(WiFi.status()== WL_CONNECTED)
- { //Check WiFi connection status
- HTTPClient http; //Declare object of class HTTPClient
- Serial.println("converted value="+t1);
- httpaddr = "http://iot.ijitm.com/add.php?t1="+t1;
- http.begin(httpaddr); //Specify request destination
- http.addHeader("Content-Type", "application/x-www-form-urlencoded"); //Specify content-type header
- Serial.println(httpaddr);
- int httpCode = http.GET(); //Send the request
- Serial.println("httpcode=");
- Serial.println(httpCode);
- 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
- {
- Serial.println("Error in WiFi connection");
- }
Add Comment
Please, Sign In to add comment