GY-63_MS5611/libraries/CHT8305/examples/CHT8305_minimal/CHT8305_minimal.ino

53 lines
965 B
Arduino
Raw Normal View History

2022-10-07 05:41:02 -04:00
//
// FILE: CHT8305_minimal.ino
// AUTHOR: Rob Tillaart
// PURPOSE: Demo for CHT8305 I2C humidity & temperature sensor
//
// Always check datasheet - front view
//
// +---------------+
// VCC ----| VCC |
// SDA ----| SDA CHT8305 | TODO CHECK DATASHEET.
// GND ----| GND |
// SCL ----| SCL |
// ? ----| AD0 | ? depends on address to select
// | |
// IRQ ----| ALERT | only if enabled.
// +---------------+
#include "CHT8305.h"
CHT8305 CHT;
2022-10-09 10:31:16 -04:00
2022-10-07 05:41:02 -04:00
void setup()
{
Serial.begin(115200);
2022-10-09 14:22:05 -04:00
CHT.begin(0x40); // default address
Wire.setClock(400000);
2022-10-07 05:41:02 -04:00
delay(1000);
}
void loop()
{
if (millis() - CHT.lastRead() >= 1000)
{
// READ DATA
2022-10-09 14:22:05 -04:00
CHT.read();
2022-10-07 05:41:02 -04:00
2022-10-09 14:22:05 -04:00
Serial.print(millis());
Serial.print('\t');
Serial.print(CHT.getHumidity());
Serial.print('\t');
Serial.println(CHT.getTemperature());
2022-10-07 05:41:02 -04:00
}
}
2022-10-09 10:31:16 -04:00
// -- END OF FILE --