Skip to content

sanket2994/sht1x-library-Arduino

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

sht1x-library-Arduino

This is a library in c for sht1x sensor for Arduino

This is a library in c which contains the following functions:

  1. float readTempC(); //calc temp in celcius Include this function in your main file to get the temperature values in celcius note that the calculation is done considering 14-bit raw data

  2. float readTempF(); //calculate temp in farhenite Include this function in your main file to get the temperature values in farhenite note that the calculation is done considering 14-bit raw data

  3. float readHumidity(); //calculate relative humidity Include this function in your main file to calculate the humidity. The calculation is done for 12 bit raw data. Also the function returns temperature compensated humidity. refer the datasheet for details.

No need to include the following functions in the main as they re internally called by the above functions 4. int getTempfrmSensor(); //get temperature raw data Get the 14-bit raw data from sensor to calculate temperature

  1. int getHumidityfrmSensor(); //get humidity raw data Get the 12-bit raw data from sensor to caculate humidity

  2. void sendCmd(int ); //send command to start measurement send a command to sensor to start measuring temperature or humidity. cmd_temp=00011; cmd_humidity=00101;

  3. void waitForResult(); //wait till sensor has finished measuring data Waiting for sensor to complete measuring the data and acknowledging the completion of measurement by pulling the data line low

  4. void skipCRC(); //skip the CRC check Skip the CRC check.

Note: 1. Since this is a c library while including the header file in your code do it as follows: extern "c"{ #include<sht11.h> } 2. The repository also contains a main.ino file which will serve as an example as to how you can code using the library.