Serial.print don't work

Hi every,

I work with the SHT20 sensor and I've got the sketch below

#include <Wire.h>
#include "DFRobot_SHT20.h"

DFRobot_SHT20    sht20;

void setup()
{
    Serial.begin(9600);
    Serial.println("SHT20 Example!");
    sht20.initSHT20();                                  // Init SHT20 Sensor
    delay(100);
    sht20.checkSHT20();                                 // Check SHT20 Sensor

    //sht20_sensor();
    
}

void loop(){
  
  float humd = sht20.readHumidity();                  // Read Humidity
    float temp = sht20.readTemperature();               // Read Temperature
    Serial.print(" Temperature:");
    Serial.print(temp, 1);                              // Prints the temperature with one decimal accuracy
    Serial.print("C");
    Serial.print(" Humidity:");
    Serial.print(humd, 1);                              // Prints the humidity with one decimal accuracy
    Serial.println("%");
    delay(1000);  
    }



//void sht20_sensor(){
    
 //}

I do not have any compilation errors but the serial monitor won't print the Serial.println("SHT20 Example!"); which is written in the setup function.

Any advice?

Does it print the output from the rest of the program ?

Yes it does

Move your Serial.println("SHT20 Example!"); two lines down (below delay(100))

Nothing changed.. Furthermore when I call a function ig sht20_sensor(); (instead of using the loop function) from the setup the serial monitor appears nothing

#include <Wire.h>
#include "DFRobot_SHT20.h"

DFRobot_SHT20    sht20;

void setup()
{
    Serial.begin(9600);
    Serial.println("SHT20 Example!");
    sht20.initSHT20();                                  // Init SHT20 Sensor
    delay(100);
    sht20.checkSHT20();                                 // Check SHT20 Sensor

    sht20_sensor();
    
}

void loop(){ 
  
  }

void sht20_sensor(){
    float humd = sht20.readHumidity();                  // Read Humidity
    float temp = sht20.readTemperature();               // Read Temperature
    Serial.print(" Temperature:");
    Serial.print(temp, 1);                              // Prints the temperature with one decimal accuracy
    Serial.print("C");
    Serial.print(" Humidity:");
    Serial.print(humd, 1);                              // Prints the humidity with one decimal accuracy
    Serial.println("%");
    delay(1000);  
 }

Which Arduino board are you using?

Arduino Uno

This is not a problem for my UNO (the sketch uploaded without real sensor).
sm81.png

sm81.png