DHT11 / capteur de sol

1 次查看(过去 30 天)
Francis Cote
Francis Cote 2020-5-9
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);
}

回答(1 个)

Christopher Stapels
移动:Christopher Stapels 2024-1-5
& field1 = Take the spaces out.
'&field1='

社区

更多回答在  ThingSpeak Community

类别

Help CenterFile Exchange 中查找有关 ThingSpeak 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by