/* Using Arduino for Citizen Science!
   Project 2: Hard(er) Digital Sensors: DHT11 temp and humidity sensor
    This project reads in the DHT temp and humidity sensor and prints 
    the data to the Serial Monitor.
      
 Written by jenfoxbot <jenfoxbot@gmail.com>
 Code is MIT license (non-commercial open-source)
*/
//Snag the DHT libraries

#include <DHT.h>
#include <DHT_U.h>

// Define the pin our sensor is connected to
#define DHT_PIN 2
//Define the type of sensor (DHT11)
#define DHT_TYPE DHT11

//Create a DHT object to store the pin and type of sensor
DHT dht = DHT(DHT_PIN, DHT_TYPE);


void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial.println("DHT11 test!");

  //start the process of reading in the serial data!
  dht.begin();

}

void loop() {
  // put your main code here, to run repeatedly:
  
  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float humidity = dht.readHumidity();
  // Read temperature as Celsius (the default)
  float tempC = dht.readTemperature();
  // Read temperature as Fahrenheit (isFahrenheit = true)
  float tempF = dht.readTemperature(true);
  //Add a delay so we can see the readings
  delay(2000);

  //Let's print out our data!
  Serial.print("Humidity: ");
  Serial.print(humidity);
  Serial.print("%  Temp: ");
  Serial.print(tempF); //want to print celcius? Swap tempF for tempC! 
  Serial.println("°F "); // .. and replace this F with a C :)


}