Created
November 1, 2013 20:49
-
-
Save dansteingart/7271724 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * ReadSHT1xValues | |
| * | |
| * Read temperature and humidity values from an SHT1x-series (SHT10, | |
| * SHT11, SHT15) sensor. | |
| * | |
| * Copyright 2009 Jonathan Oxer <jon@oxer.com.au> | |
| * www.practicalarduino.com | |
| */ | |
| #include <SHT1x.h> | |
| #include <Bridge.h> | |
| // Specify data and clock connections and instantiate SHT1x object | |
| #define dataPin A5 | |
| #define clockPin A4 | |
| SHT1x sht1x(dataPin, clockPin); | |
| void setup() | |
| { | |
| pinMode(A0,OUTPUT); | |
| digitalWrite(A0,LOW); | |
| pinMode(A1,OUTPUT); | |
| digitalWrite(A1,HIGH); | |
| Bridge.begin(); // this launches /usr/bin/run-bride on Linino | |
| } | |
| void loop() | |
| { | |
| float temp_c; | |
| float temp_f; | |
| float humidity; | |
| int light; | |
| // Read values from the sensor | |
| temp_c = sht1x.readTemperatureC(); | |
| temp_f = sht1x.readTemperatureF(); | |
| humidity = sht1x.readHumidity(); | |
| light = analogRead(3); | |
| Bridge.put("Temp", String(temp_c)); | |
| Bridge.put("Humdity", String(humidity)); | |
| Bridge.put("Light",String(light)); | |
| delay(1000); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment