You didn’t answer my question about the covers.
Another question, when I received the components, they were in a gray plastic bag. I think it’s because of the waves. Is that right?
I did steps 1-4 of the setup as instructed in the guide, which states that for the example it is using an Arduino Uno board.
Apart from these settings on the shield, I haven’t touched anything.
I didn’t say you need to update the firmware or issue AT commands, I asked if you have done either of those.
I do neither.
You’ve spent far more on your WiFi shield than an ESP32 dev board would have cost.
I know but I didn’t want to complicate things for myself.
I don’t know where the NCP code lines are.
Here is my code. Just tell me, if you have time, what’s wrong and how I can fix it. On some lines, I put question marks because I think that is the one that poses a problem.
#define BLYNK_TEMPLATE_ID "Template ID"
#define BLYNK_TEMPLATE_NAME "Name"
#define BLYNK_AUTH_TOKEN "" //??
#define BLYNK_PRINT Serial //??
#define BLYNK_FIRMWARE_VERSION "0.1.0" //??
#define BLYNK_PRINT Serial //??
#define BLYNK_DEBUG //??
#define APP_DEBUG //??
#define DHT11_PIN 6
#include <ESP8266_Lib.h>
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <BlynkRpcClient.h> //??
#include <Blynk.h>
#include <SoftwareSerial.h> //??
#include "DHT.h"
char ssid[] = "ssid";
char pass[] = "pass";
int Relaispin = 7;
const int seuilHumidite = 400;
DHT dht(6, DHT11);
SoftwareSerial EspSerial(2, 3);
#define ESP8266_BAUD 9600;
ESP8266 wifi(&EspSerial);
void setup() {
pinMode(DHT11, INPUT);
pinMode(Relaispin, OUTPUT);
pinMode(Relaispin, Low);
digitalWrite(DHT11, LOW);
{ Serial.begin(115200); //??
EspSerial.begin(ESP8266_BAUD);
delay(10); //??
Blynk.begin(BLYNK_AUTH_TOKEN, wifi, ssid, pass); // On peut également spécifier le serveur : //??
//Blynk.begin(BLYNK_AUTH_TOKEN, wifi, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(BLYNK_AUTH_TOKEN, wifi, ssid, pass, IPAddress(192,168,1,100), 8080);
} { Serial.begin(115200); //???
} BLYNK_WRITE(V0) { // Executes when the value of virtual pin 0 changes
if (param.asInt() == 1) {
digitalWrite(7, HIGH); // Set digital pin 2 HIGH // execute this code if the switch widget is now ON
} else {
// execute this code if the switch widget is now OFF
digitalWrite(7, LOW); // Set digital pin 2 LOW
}
}
}
void loop() { //Ce qui se répette tout le temps
Blynk.run();
digitalWrite(DHT11, HIGH);
float h = dht.readHumidity();
float t = dht.readTemperature();
Serial.print("Humidite: ");
Serial.println(h);
Serial.print("Temperature: ");
Serial.println(t);
delay(90000); // Attendre 90 secondes soit 1 min et 30 s
int valeurHumidite = analogRead(DHT11);
if (valeurHumidite < seuilHumidite) {
digitalWrite(Relaispin, HIGH);
Serial.println("Pompe allumée. Arrosage en cours...");
} else {
digitalWrite(Relaispin, LOW);
Serial.println("Pompe éteinte.");
}
}