PRIMER PARCIAL- SEGUNDO QUIMESTRE

Miercoles 11 de Septiembre de 2019
Sensor DHT11 
Los siguientes códigos sirven para medir la temperatura y humedad

Serial.print("Humidity: ");
   Serial.print(h);
   Serial.print(" %\t");
   Serial.print("Temperature: ");
   Serial.print(t);
   Serial.print(" *C ");
 
   if(t>26)
   (
    digitalWrite(5,HIGH);// encender motor
   )
   else
   (
    digitalWrite(5, LOW);// apagar motor
   )
 
   )


DHT11

// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

int DHTPin = 5;     // what digital pin we're connected to

DHT dht(DHTPin, DHTTYPE);

void setup() {
   Serial.begin(9600);
   Serial.println("Moniteroando valores"); 
   dht.begin();
}

void loop() {
   // Wait a few seconds between measurements.
   delay(2000);

   // Reading temperature or humidity takes about 250 milliseconds!
   float h = dht.readHumidity();
   float t = dht.readTemperature();

   if (isnan(h) || isnan(t)) {
      Serial.println("Failed to read from DHT sensor!");
      return;
   }


   Serial.print("Humidity: ");
   Serial.print(h);
   Serial.print(" %\t");
   Serial.print("Temperature: ");
   Serial.print(t);
   Serial.print(" *C ");
   
   if(t>26)
   (
    digitalWrite(5,HIGH);// encender motor
   )
   else
   (
    digitalWrite(5, LOW);// apagar motor 
   )
   

}



Comentarios

Entradas populares de este blog

Bitacora Pulsador

Clase Mecánica #2

Clase Mecánica #5