Skip to content

Instantly share code, notes, and snippets.

@not-for-me
Created December 31, 2014 02:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save not-for-me/1c74a3371f9a5fba5ec7 to your computer and use it in GitHub Desktop.
Save not-for-me/1c74a3371f9a5fba5ec7 to your computer and use it in GitHub Desktop.
//Arduino Sample Code for SHT1x Humidity and Temperature Sensor
//www.DFRobot.com
//Version 1.0
#include <SHT1x.h>
// Specify data and clock connections and instantiate SHT1x object
#define dataPin 10
#define clockPin 11
SHT1x sht1x(dataPin, clockPin);
void setup()
{
Serial.begin(9600); // Open serial connection to report values to host
}
void loop()
{
float temp_c;
float humidity;
// Read values from the sensor
temp_c = sht1x.readTemperatureC();
humidity = sht1x.readHumidity();
// Print the values to the serial port
Serial.print("Temperature: ");
Serial.print(temp_c, DEC);
Serial.print("C ");
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println("%");
delay(2000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment