Advertisement
mrjonny2

SHT2x.h

Aug 15th, 2012
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.60 KB | None | 0 0
  1. /*
  2.   SHT2x - A Humidity Library for Arduino.
  3.  
  4.   Supported Sensor modules:
  5.     SHT21-Breakout Module - http://www.moderndevice.com/products/sht21-humidity-sensor
  6.     SHT2x-Breakout Module - http://www.misenso.com/products/001
  7.    
  8.   Created by Christopher Ladden at Modern Device on December 2009.
  9.  
  10.   Modified by www.misenso.com on October 2011:
  11.     - code optimisation
  12.     - compatibility with Arduino 1.0
  13.  
  14.   This library is free software; you can redistribute it and/or
  15.   modify it under the terms of the GNU Lesser General Public
  16.   License as published by the Free Software Foundation; either
  17.   version 2.1 of the License, or (at your option) any later version.
  18.  
  19.   This library is distributed in the hope that it will be useful,
  20.   but WITHOUT ANY WARRANTY; without even the implied warranty of
  21.   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  22.   Lesser General Public License for more details.
  23.  
  24.   You should have received a copy of the GNU Lesser General Public
  25.   License along with this library; if not, write to the Free Software
  26.   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  27. */
  28.  
  29.  
  30. #ifndef SHT2X_H
  31. #define SHT2X_H
  32.  
  33. #include <inttypes.h>
  34.  
  35. typedef enum {
  36.     eSHT2xAddress = 0x40,
  37. } HUM_SENSOR_T;
  38.  
  39. typedef enum {
  40.     eTempHoldCmd        = 0xE3,
  41.     eRHumidityHoldCmd   = 0xE5,
  42.     eTempNoHoldCmd      = 0xF3,
  43.     eRHumidityNoHoldCmd = 0xF5,
  44. } HUM_MEASUREMENT_CMD_T;
  45.  
  46. class SHT2xClass
  47. {
  48.   private:
  49.     uint16_t readSensor(uint8_t command);
  50.  
  51.   public:
  52.     float GetHumidity(void);
  53.     float GetTemperature(void);
  54. };
  55.  
  56. extern SHT2xClass SHT2x;
  57.  
  58. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement