From 5c629da05aea1042f57495bc5f4025721bbcbcb2 Mon Sep 17 00:00:00 2001 From: Fabian Daume Date: Tue, 5 Apr 2022 12:48:22 +0200 Subject: [PATCH] Update 'DHT11toMYSQL.ino' --- DHT11toMYSQL.ino | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/DHT11toMYSQL.ino b/DHT11toMYSQL.ino index e054ff2..4da49e0 100644 --- a/DHT11toMYSQL.ino +++ b/DHT11toMYSQL.ino @@ -18,24 +18,18 @@ String PATH_NAME = "/search"; WiFiClient client; void setup() { - //Initialize serial and wait for port to open: Serial.begin(9600); - dht.begin(); - while ( status != WL_CONNECTED) { Serial.print("Attempting to connect to Network named: "); Serial.println(ssid); // print the network name (SSID); - // Connect to WPA/WPA2 network: status = WiFi.begin(ssid, pass); } - // print the SSID of the network you're attached to: Serial.print("SSID: "); Serial.println(WiFi.SSID()); - // print your WiFi shield's IP address: IPAddress ip = WiFi.localIP(); Serial.print("IP Address: "); @@ -43,7 +37,8 @@ void setup() { } void loop(){ -delay(30000); // 30sec measurement interval +// 30sec measurement interval +delay(30000); float h = dht.readHumidity(); float t = dht.readTemperature(); @@ -56,13 +51,11 @@ delay(30000); // 30sec measurement interval } else { Serial.println("connection failed"); } - // send HTTP request header client.println("GET "+ PATH_NAME + queryString + " HTTP/1.1"); client.println("Host: google.com"); client.println("Connection: close"); client.println(); // end HTTP request header - //send HTTP body client.println(queryString); @@ -72,7 +65,6 @@ client.println(); // end HTTP request header char c = client.read(); Serial.print(c); } - if(!client.connected()) { // if the server's disconnected, stop the client: