pdf-icon

SHT30

Begin()

Functionality:

Initializes the SHT30 temperature and humidity sensor.

Function Prototype:

void Begin()

UpdateData()

Functionality:

Refreshes the measurement data.

  1. This API must be called to obtain new measurement values.

Function Prototype:

uint8_t UpdateData()

GetTemperature()

Functionality:

Reads the temperature measured by the SHT30 sensor.

Function Prototype:

float GetTemperature(TemperatureScale Degree = Cel)

GetRelHumidity()

Functionality:

Reads the humidity measured by the SHT30 sensor.

Function Prototype:

float GetRelHumidity()

Usage Example:

#include <M5EPD.h>
char temStr[10],humStr[10];
float tem,hum;

M5EPD_Canvas canvas(&M5.EPD);
void setup(){
    M5.begin();
    M5.SHT30.Begin();
    M5.EPD.SetRotation(90);
    M5.EPD.Clear(true);
    canvas.createCanvas(400, 300);
    canvas.setTextSize(2);
}

void loop(){
    M5.SHT30.UpdateData();
    tem = M5.SHT30.GetTemperature();
    hum = M5.SHT30.GetRelHumidity();
    Serial.printf("Temperature: %2.2f*C  Humidity: %0.2f%%\r\n", tem, hum);
    dtostrf(tem, 2, 2 , temStr);
    dtostrf(hum, 2, 2 , humStr);
    canvas.drawString("Temperature:" + String(temStr) + "*C", 100, 100);
    canvas.drawString("Humidity:" + String(humStr) , 100, 200);
    canvas.pushCanvas(0,300,UPDATE_MODE_A2);
    delay(1000);
}
On This Page