Francis Cote in MATLAB Answers
Last activity on 5 Jan 2024

Bonjour, J'essai d'utiliser un DHT11 et un capteur de sol.Seulement,le field1 et field2 s'affichent.Le capteur de solField3ne s'affiche pas. ///////////////////////////////// // Generated with a lot of love// // with TUNIOT FOR ESP8266 // // Website: Easycoding.tn // ///////////////////////////////// #include <ESP8266WiFi.h> #include "DHT.h" #include <ESP8266HTTPClient.h> WiFiClient client; DHT dht2(2,DHT11); String thingSpeakAddress= "http://api.thingspeak.com/update?"; String writeAPIKey; String tsfield1Name; String request_string; HTTPClient http; void setup() { Serial.begin(115200); WiFi.disconnect(); delay(3000); Serial.println("START"); WiFi.begin("xxxxxx","xxxxxx"); while ((!(WiFi.status() == WL_CONNECTED))){ delay(300); Serial.print(".."); } Serial.println("Connected"); Serial.println("Your IP is"); Serial.println((WiFi.localIP().toString())); } void loop() { if (client.connect("api.thingspeak.com",80)) { request_string = thingSpeakAddress; request_string += "key="; request_string += " 577YXKILO0SBRQFS"; request_string += "&field1="; request_string += (dht2.readTemperature( )); request_string += "&field2="; request_string += dht2.readHumidity( ); request_string += "&field3="; request_string += analogRead(A0); http.begin(request_string); http.GET(); http.end(); request_string=""; delay(15000); } Serial.println("Valeurs envoyees en principe"); Serial.println("Temperature"); Serial.println((dht2.readTemperature( ))); Serial.println("Humidity"); Serial.println((dht2.readHumidity( ))); Serial.println("Humidity Sol"); Serial.println(analogRead(A0)); delay(15000); }

About ThingSpeak

The community for students, researchers, and engineers looking to use MATLAB, Simulink, and ThingSpeak for Internet of Things applications. You can find the latest ThingSpeak news, tutorials to jump-start your next IoT project, and a forum to engage in a discussion on your latest cloud-based project. You can see answers to problems other users have solved and share how you solved a problem.