DHT11 / capteur de sol
1 view (last 30 days)
Show older comments
Bonjour,
J'essai utilisé un DHT11 et un capteur de sol.Seulement, le field1 et field2 s'affichent.Le capteur de solField3ne s'affiche pas.
///////////////////////////////////
// Généré avec beaucoup d'amour //
// avec TUNIOT POUR ESP8266 //
// Site Web: Easycoding.tn //
///////////////////////////////////
# inclut <ESP8266WiFi.h>
# inclure "DHT.h"
# inclut <ESP8266HTTPClient.h>
Client WiFiClient ;
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 ();
retard (3000);
Serial.println ( "START" );
WiFi.begin ( "xxxxxx" , "xxxxxx" );
while (( ! (WiFi.status () == WL_CONNECTED))) {
retard (300);
Serial.print ( ".." );
}
Serial.println ( "Connecté" );
Serial.println ( "Votre IP est" );
Serial.println ((WiFi.localIP (). ToString ()));
}
boucle vide ()
{
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 = "" ;
retard (15000);
}
Serial.println ( "Valeurs envoyés en principe" );
Serial.println ( "Température" );
Serial.println ((dht2.readTemperature ()));
Serial.println ( "Humidité" );
Serial.println ((dht2.readHumidity ()));
Serial.println ( "Humidity Sol" );
Serial.println (analogRead (A0));
retard (15000);
}
0 Comments
Answers (1)
Christopher Stapels
on 11 May 2020
Moved: Christopher Stapels
on 5 Jan 2024
& field1 = Take the spaces out.
'&field1='
0 Comments
Communities
More Answers in the ThingSpeak Community
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!