Created
September 26, 2018 10:36
sht10
This file contains 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
#include | |
#define dataPin 10 | |
#define clockPin 11 | |
SHT1x sht1x(dataPin, clockPin); | |
void setup() | |
{ | |
Serial.begin(38400); // Open serial connection to report values to host | |
Serial.println("Starting up"); | |
} | |
void loop() | |
{ | |
float temp_c; | |
float temp_f; | |
float humidity; | |
temp_c = sht1x.readTemperatureC(); | |
temp_f = sht1x.readTemperatureF(); | |
humidity = sht1x.readHumidity(); | |
Serial.print("Temperature: "); | |
Serial.print(temp_c, DEC); | |
Serial.print("C / "); | |
Serial.print(temp_f, DEC); | |
Serial.print("F. 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