i already change port and the uploud speed but still same.anyone have same problem like me?
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
#define BLYNK_PRINT Serial
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS V2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
char auth[] =""; //Authentication code sent by Blynk
char ssid[] = ""; //WiFi SSID
char pass[] = ""; //WiFi Password
#define sensorPin V3
int sensorState = 0;
int lastState = 0;
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;
void sendSensor()
{
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
Blynk.virtualWrite(V5, h); //V5 is for Humidity
Blynk.virtualWrite(V6, t); //V6 is for Temperature
}
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
pinMode(sensorPin, INPUT);
dht.begin();
timer.setInterval(1000L, sendSensor);
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
sensors.begin();
}
int sensor=0;
void sendTemps()
{
sensor=analogRead(A0);
sensors.requestTemperatures();
float temp = sensors.getTempCByIndex(0);
Serial.println(temp);
Serial.println(sensor);
Blynk.virtualWrite(V1, temp);
Blynk.virtualWrite(V2,sensor);
delay(1000);
}
void loop()
{
Blynk.run();
timer.run();
sendTemps();
sensorState = digitalRead(sensorPin);
Serial.println(sensorState);
if (sensorState == 1 && lastState == 0) {
Serial.println("needs water, send notification");
Blynk.notify("Water your plants");
lastState = 1;
delay(1000);
//send notification
}
else if (sensorState == 1 && lastState == 1) {
//do nothing, has not been watered yet
Serial.println("has not been watered yet");
delay(1000);
}
else {
//st
Serial.println("does not need water");
lastState = 0;
delay(1000);
}
delay(100);
}
and the bug is
Sketch uses 288797 bytes (27%) of program storage space. Maximum is 1044464 bytes.
Global variables use 30600 bytes (37%) of dynamic memory, leaving 51320 bytes for local variables. Maximum is 81920 bytes.
esptool.py v3.0
Serial port COM6
Connecting...
Traceback (most recent call last):
File "C:\Users\Asus\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.0/tools/upload.py", line 66, in <module>
esptool.main(cmdline)
File "C:/Users/Asus/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/3.0.0/tools/esptool\esptool.py", line 3552, in main
esp.connect(args.before, args.connect_attempts)
File "C:/Users/Asus/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/3.0.0/tools/esptool\esptool.py", line 519, in connect
last_error = self._connect_attempt(mode=mode, esp32r0_delay=False)
File "C:/Users/Asus/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/3.0.0/tools/esptool\esptool.py", line 499, in _connect_attempt
self.sync()
File "C:/Users/Asus/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/3.0.0/tools/esptool\esptool.py", line 438, in sync
timeout=SYNC_TIMEOUT)
File "C:/Users/Asus/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/3.0.0/tools/esptool\esptool.py", line 376, in command
self.write(pkt)
File "C:/Users/Asus/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/3.0.0/tools/esptool\esptool.py", line 339, in write
self._port.write(buf)
File "C:/Users/Asus/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/3.0.0/tools/pyserial\serial\serialwin32.py", line 325, in write
raise SerialTimeoutException('Write timeout')
serial.serialutil.SerialTimeoutException: Write timeout
the selected serial port serial.serialutil.SerialTimeoutException: Write timeout
does not exist or your board is not connected