The SHT 1X temperature and humidity sensor code

hi everyone, I got a SHT1x sensor for the temperature and humidity monitoring, and I used the simple code, but the data collected every 1s, which I think is default. Is there anyone knows how can I modify this frequency? Thank you very much.

The library (this one) allows you to read the sensor whenever you like.

.. read it more often if you like.

Can you post the code you used?

robtillaart:
Can you post the code you used?

#include <Wire.h>

#include <SHTSensor.h>

SHTSensor sht;

void setup() {
// put your setup code here, to run once:

Wire.begin();
Serial.begin(9600);
sht.init();
}

void loop() {
// put your main code here, to run repeatedly:

sht.readSample();
Serial.print(“SHT:\n”);
Serial.print(" RH: “);
Serial.print(sht.getHumidity(), 2);
Serial.print(”\n");
Serial.print(" T: “);
Serial.print(sht.getTemperature(), 2);
Serial.print(”\n");

delay(1000);
}

remove the line delay(1000);

robtillaart:
remove the line delay(1000);

I have tried, but nothing change.

Try this code and post the output

#include <Wire.h>

#include <SHTSensor.h>

SHTSensor sht;

void setup()
{
  Serial.begin(115200);
  Serial.println(__FILE__);

  Wire.begin();
  sht.init();
}

void loop() 
{
  sht.readSample();

  Serial.print(millis());
  Serial.print('\t');
  Serial.print(sht.getHumidity(), 2);
  Serial.print('\t');
  Serial.print(sht.getTemperature(), 2);
  Serial.println();
}