sensor water insieme al dht11

sensor water insieme al dht11 © Apache-2.0

indica la temperatura sia della serra sia della pianta

  • 24 views
  • 1 comment
  • 0 respects

Components and supplies

Apps and online services

About this project

questo progetto consiste di indicare la temperatura e l'umidita. dell' aria, e del terreno

Code

Untitled fileC/C++
#include <SimpleDHT.h>
// for DHT11, 
//      VCC: 5V or 3V
//      GND: GND
//      DATA: 2
const int soglia_critica = 300; //Soglia alla quale il led sarà ON
int pinDHT11 = 2;
SimpleDHT11 dht11;

void setup() {
  Serial.begin(9600);
  pinMode(9, OUTPUT);
}

void loop() {
  // start working...
  int sensorValue = analogRead(A0); //Legge il valore analogico
Serial.println(sensorValue); //Stampa a schermo il valore
if (sensorValue <= soglia_critica)
digitalWrite(9,HIGH); //Accendi led
else
digitalWrite(9,LOW); //Spegni led
delay(2000); //Attende due secondi
  Serial.println("=================================");
  Serial.println("Sample DHT11...");
  
  // read without samples.
  byte temperature = 0;
  byte humidity = 0;
  int err = SimpleDHTErrSuccess;
  if ((err = dht11.read(pinDHT11, &temperature, &humidity, NULL)) != SimpleDHTErrSuccess) {
    Serial.print("Read DHT11 failed, err="); Serial.println(err);delay(1000);
    return;
  }
  
  Serial.print("Sample OK: ");
  Serial.print((int)temperature); Serial.print(" *C, "); 
  Serial.print((int)humidity); Serial.println(" H");
  
  // DHT11 sampling rate is 1HZ.
  delay(1500);
}

Comments

Similar projects you might like

DHT11 Sensor with LEDs and a Piezo Speaker

Project tutorial by Tech with Matthew

  • 6,242 views
  • 3 comments
  • 20 respects

DHT11 Humidity + Temperature Sensor with 16x2 LCD display

Project showcase by onatto22

  • 9,148 views
  • 1 comment
  • 17 respects

How To Use DS18B20 Water Proof Temperature Sensor

Project showcase by IoTBoys

  • 45,847 views
  • 12 comments
  • 17 respects

DHT11 /DHT22 Temperature Sensor

Project tutorial by Daniel Porrey

  • 82,670 views
  • 106 comments
  • 133 respects

DHT11 Temperature/Humidity Sensor

Project tutorial by Zachary Haslam

  • 16,748 views
  • 1 comment
  • 33 respects
Add projectSign up / Login