moon
Dependencies: Hexi_OLED_SSD1351
Moon_HUMTEMP.h
00001 00002 #include "mbed.h" 00003 00004 // Acquired from Datasheet. 00005 00006 #define HTU21D_I2C_ADDRESS 0x40 00007 #define TRIGGER_TEMP_MEASURE 0xE3 00008 #define TRIGGER_HUMD_MEASURE 0xE5 00009 00010 00011 //Commands. 00012 #define HTU21D_EEPROM_WRITE 0x80 00013 #define HTU21D_EEPROM_READ 0x81 00014 00015 #ifndef HTU21D_H 00016 #define HTU21D_H 00017 00018 00019 /** 00020 * MOONSHOT HTU21D digital humidity and temperature sensor. 00021 */ 00022 class HTU21D { 00023 00024 public: 00025 00026 00027 HTU21D(PinName sda, PinName scl); 00028 00029 00030 // GET SAMPLES FOR TEMP(in Celcuis) 00031 int sampleTemp_cel(void); 00032 00033 // GET SAMPLES FOR TEMP(in fahrenheit) 00034 int sampleTemp_fah(void); 00035 00036 // GET SAMPLES FOR TEMP(in Kelvin) 00037 int sampleTemp_kel(void); 00038 00039 // SAMPLES OF HUMIDITY 00040 int sample_Humid(void); 00041 00042 00043 00044 private: 00045 00046 I2C* i2c_; 00047 00048 00049 void write(int EepromOrRam, int address, int data); // writing to EEPROM or Ram (destination, address to write to, data to write) 00050 00051 00052 int read(int EepromOrRam, int address); //Reading from EEprom (destination, add to read from) 00053 00054 }; 00055 00056 #endif /* HTU21D_H */ 00057
Generated on Tue Jul 12 2022 18:19:43 by
1.7.2