Hi
Google is full of answers to solve this problem,I have tried some of them. My case is that it happens all the time.
I have changed cable, I have changed upload baud rate. Nothing helps.....
I have 2 brand new WeMos D1 mini Node MCU WIFI
I uploaded BLINK code to both of them:
Test 1 perfect, all did work
Test 2 both give error.
espcomm_sync failed
I used board type Node MCU 0.9 (ESP12 Module), also tried version 1.0
The code I try to upload now is:
/* TO test 1/8-22 ESP8266 Node MCU WIFI 12F DOITING
* TO Test 29.7.22 on board TTGO LoRa32-Oled V2.1 (1.6.1)
DHT20: (colours of soldered wires
VCC Yellow -> 5V
SDA Black -> D2 I2C bus
GND Green -> GND
SCL Red -> D1 I2C bus
I2C port 0x38 (Dont know if adressing is nessesary due to code working.
*/
//
// FILE: DHT20 test xyz
// AUTHOR: Rob Tillaart
// PURPOSE: Demo for DHT20 I2C humidity & temperature sensor
//
#include <DHT20.h>
DHT20 DHT;
void setup()
{
DHT.begin();
Wire.setClock(400000);
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("DHT20 LIBRARY VERSION: ");
Serial.println(DHT20_LIB_VERSION);
Serial.println();
delay(2000);
Serial.println("Type,\tStatus,\tHumidity (%),\tTemperature (C)");
}
void loop()
{
if (millis() - DHT.lastRead() >= 1000)
{
// READ DATA
uint32_t start = micros();
int status = DHT.read();
uint32_t stop = micros();
switch (status)
{
case DHT20_OK:
Serial.print("OK,\t");
break;
case DHT20_ERROR_CHECKSUM:
Serial.print("Checksum error,\t");
break;
case DHT20_ERROR_CONNECT:
Serial.print("Connect error,\t");
break;
case DHT20_MISSING_BYTES:
Serial.print("Missing bytes,\t");
break;
default:
Serial.print("Unknown error,\t");
break;
}
// DISPLAY DATA, sensor has only one decimal.
Serial.print("DHT20, \t");
Serial.print(DHT.getHumidity(), 1);
Serial.print(",\t");
Serial.print(DHT.getTemperature(), 1);
//Serial.print(",\t");
//Serial.print(start - stop);
Serial.print("\n");
}
}
// -- END OF FILE --