st-anything/lib/Adafruit_Si7021/examples/si7021.ino

26 lines
511 B
Arduino
Raw Permalink Normal View History

2023-03-11 14:11:03 +00:00
#include "Adafruit_Si7021.h"
Adafruit_Si7021 sensor = Adafruit_Si7021();
void setup() {
Serial.begin(115200);
// wait for serial port to open
while (!Serial) {
delay(10);
}
Serial.println("Si7021 test!");
if (!sensor.begin()) {
Serial.println("Did not find Si7021 sensor!");
while (true);
}
}
void loop() {
Serial.print("Humidity: "); Serial.print(sensor.readHumidity(), 2);
Serial.print("\tTemperature: "); Serial.println(sensor.readTemperature(), 2);
delay(1000);
}