/* Lab10 - SHT1x serials (SHT10, SHT11, SHT15) Reading sample of hygrothermograph * * Need to install SHT1x Library: * [url]https://github.com/practicalarduino/SHT1x/[/url] */ #include // define SHT1x connection pin #define dataPin 11 #define clockPin 10 // Initialize sht1x object SHT1x sht1x(dataPin, clockPin); void setup() { Serial.begin(9600); } void loop() { // declare three variables, representing temperature (Celsius), temperature (Fahrenheit) and humidity float temp_c, temp_f, humidity; // read SHT1x temperature and humidity value temp_c = sht1x.readTemperatureC(); temp_f = sht1x.readTemperatureF(); humidity = sht1x.readHumidity(); // Output the temperature and humidity value to Serial Port Serial.print("Temperature: "); Serial.print(temp_c, 1); // Show one after the decimal point Serial.print("C / "); Serial.print(temp_f, 1); // Show one after the decimal point Serial.print("F. Humidity: "); Serial.print(humidity); Serial.println("%"); delay(1000); }