Paso 3: Sketch de Arduino
#include "DHT.h"
#define DHTPIN 30
int sensorPin = A0;
unsigned int sensorValue = 0;
#define DHTTYPE DHT11
DHT dht (DHTPIN, DHTTYPE);
void setup() {}
Serial.Begin(115200);
DHT.Begin();
}
void loop() {}
Float h = dht.readHumidity();
Float t = dht.readTemperature();
sensorValue = analogRead(sensorPin);
Si (isnan(t) || isnan(h) || h == 0) {}
Serial.Print("\n");
} else {}
Serial.Print ("humedad:");
Serial.Print(h);
Serial.Print("%\n");
Serial.Print ("temperatura:");
Serial.Print(t);
Serial.Print ("* C\n");
}
Serial.Print ("humedad del suelo:");
Serial.Print (flotador (sensorValue) / 1024 * 100, 0);
Serial.Print("%\n\n");
Delay(500);
}