2021-12-29 06:35:46 -05:00
|
|
|
#pragma once
|
|
|
|
//
|
|
|
|
// FILE: tinySHT2x.h
|
|
|
|
// AUTHOR: Rob Tillaart, Viktor Balint
|
2023-11-22 11:05:57 -05:00
|
|
|
// VERSION: 0.1.3
|
2021-12-29 06:35:46 -05:00
|
|
|
// DATE: 2021-09-27
|
|
|
|
// PURPOSE: Arduino library for the SHT2x temperature and humidity sensor optimized for AVR tiny
|
|
|
|
// URL: https://github.com/RobTillaart/tinySHT2x
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#include "Arduino.h"
|
|
|
|
#include "Wire.h"
|
|
|
|
|
2023-11-22 11:05:57 -05:00
|
|
|
#define TINY_SHT2x_LIB_VERSION (F("0.1.3"))
|
2021-12-29 06:35:46 -05:00
|
|
|
|
|
|
|
#define TINY_SHT2x_NO_VALUE -999
|
|
|
|
|
|
|
|
|
|
|
|
class tinySHT2x
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
tinySHT2x();
|
|
|
|
|
|
|
|
void begin(TwoWire *wire = &Wire);
|
|
|
|
bool reset();
|
|
|
|
float getTemperature();
|
|
|
|
float getHumidity();
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool writeCmd(uint8_t cmd);
|
|
|
|
bool readBytes(uint8_t n, uint8_t *val, uint8_t maxDuration);
|
|
|
|
TwoWire* _wire;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2023-11-22 11:05:57 -05:00
|
|
|
// -- END OF FILE --
|
2021-12-29 06:35:46 -05:00
|
|
|
|