first commit
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#include <Arduino.h>
|
||||
#include <Adafruit_SHT4x.h>
|
||||
|
||||
Adafruit_SHT4x sht4 = Adafruit_SHT4x();
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600); // zacni seriovou komunikaci s baudrate 9600
|
||||
Serial.println("UART OK");
|
||||
|
||||
Serial.println("Adafruit SHT4x test"); // zadni komunikaci s SHT40 po I2C
|
||||
if (! sht4.begin())
|
||||
{
|
||||
Serial.println("Couldn't find SHT4x"); // pokud neni sensor nalezen, program skonci v nekonecne smycce
|
||||
while (1) delay(1);
|
||||
}
|
||||
Serial.println("Found SHT4x sensor");
|
||||
Serial.print("Serial number 0x");
|
||||
Serial.println(sht4.readSerial(), HEX);
|
||||
sht4.setPrecision(SHT4X_HIGH_PRECISION);
|
||||
sht4.setHeater(SHT4X_NO_HEATER);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
sensors_event_t humidity, temp;
|
||||
|
||||
uint32_t timestamp = millis();
|
||||
sht4.getEvent(&humidity, &temp); // cteni ze senzoru
|
||||
timestamp = millis() - timestamp; // ziskani delky cteni ze senzoru
|
||||
|
||||
Serial.print("temp= ");
|
||||
Serial.print(temp.temperature);
|
||||
Serial.print(" humidity=");
|
||||
Serial.println(humidity.relative_humidity);
|
||||
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user