Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By PaulRB
#23517 Hello all, can someone please help with my first esp8266 sketch? OK... second sketch, I got "blink" working!

Here is my sketch:
Code: Select all/****************************************************************
 * ReadSHT2x
 *  An example sketch that reads the sensor and prints the
 *  relative humidity to the PC's serial port
 *
 *  Tested with:
 *    - SHT21-Breakout Humidity sensor from Modern Device
 *    - SHT2x-Breakout Humidity sensor from MisensO Electronics
 ***************************************************************/

#include <Wire.h>
#include <SHT2x.h>


void setup()
{
  Serial.begin(115200);
  delay(5000);
  Serial.println("Starting Wire...");
  Wire.begin(2, 0);
}

void loop()
{
  Serial.print("Humidity(%RH): ");
  Serial.print(SHT2x.GetHumidity());
  Serial.print("     Temperature(C): ");
  Serial.println(SHT2x.GetTemperature());
 
  delay(1000);
}


And here is the output:
Code: Select allStarting Wire...
Humidity(%RH): 118.99     Temperature(C):
 ets Jan  8 2013,rst cause:4, boot mode:(3,0)

wdt reset
load 0x40100000, len 28780, room 16
tail 12
chksum 0x50
ho 0 tail 12 room 4
load 0x3ffe8000, len 1332, room 12
tail 8
chksum 0x06
load 0x3ffe8540, len 1700, room 0
tail 4
chksum 0x1d
csum 0x1d


The humidity value is clearly nonsense. The after the "Temperature(C):" appears, there is a pause of around 1s before the rest of that error message appears.

Thanks,

Paul
User avatar
By PaulRB
#23591 Hmm... reading this thread, it sounds like the message I am seeing is a "watchdog timer reset", which fires if my loop() does not complete in 1 second, or at least call wtd_feed() at least once per second.

I suspect the SHT2x.GetTemperature() is taking more than a second to complete, and so... WOOF!

So I need to either find a way to speed up SHT2x.GetTemperature() , or change it to call wtd_feed() while it is running.

This is the library I am using.