Sparkfun Electronics SHT15 Hook-Up Manual page 6

Humidity and temperature sensor
Table of Contents

Advertisement

/*************************************************************
*****************
SHT15 Example
Joel Bartlett @ SparkFun Electronics
16 Sept 2015
https://github.com/sparkfun/SparkFun_ISL29125_Breakout_Arduino
_Library
This example shows how to get the temperature in F or C and hu
midity
Developed/Tested with:
SparkFun RedBoard
Arduino IDE 1.6.5
Connections:
GND
­> A2
Vcc
­> A3
DATA ­> A4
SCK
­> A5
Requires:
SHT1X Arduino Library
https://github.com/sparkfun/SHT15_Breakout/
This code is beerware.
Distributed as­is; no warranty is given.
**************************************************************
****************/
#include <SHT1X.h>
//variables for storing values
float tempC = 0;
float tempF = 0;
float humidity = 0;
//Create an instance of the SHT1X sensor
SHT1x sht15(A4, A5);//Data, SCK
//delacre output pins for powering the sensor
int power = A3;
int gnd = A2;
void setup()
{
Serial.begin(9600); // Open serial connection to report valu
es to host
pinMode(power, OUTPUT);
pinMode(gnd, OUTPUT);
digitalWrite(power, HIGH);
digitalWrite(gnd, LOW);
}
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
void loop()
{
readSensor();
printOut();
delay(1000);
}
//­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
void readSensor()
Page 6 of 7

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the SHT15 and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents