DHT11 / capteur de sol

조회 수: 1 (최근 30일)
Francis Cote
Francis Cote 2020년 5월 9일
이동: Christopher Stapels 2024년 1월 5일
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 2020년 5월 11일
이동: Christopher Stapels 2024년 1월 5일
& field1 = Take the spaces out.
'&field1='

커뮤니티

더 많은 답변 보기:  ThingSpeak 커뮤니티

카테고리

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