Last active
February 17, 2020 17:54
-
-
Save jenschr/711899fe286ba5a63c044191b63813ca to your computer and use it in GitHub Desktop.
Very basic Arduino example for testing the HiGrow board based on ESP32, DHT11 and a capacitive moisture sensor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Very basic Arduino example for testing the HiGrow board based on ESP32, DHT11 and a capacitive moisture sensor | |
* | |
* Details on the hardware and how to use it can be found on: | |
* http://flashgamer.com/blog/comments/higrow-esp32-moisture-and-temperature-sensor#capacitive | |
*/ | |
#include "DHT.h" | |
#define DHTTYPE DHT11 | |
const int LEDPIN = 16; | |
const int DHTPIN = 22; | |
const int SOILPIN = 32; | |
DHT dht(DHTPIN, DHTTYPE); | |
void setup() { | |
Serial.begin(115200); | |
} | |
void loop() { | |
int waterlevel = analogRead(SOILPIN); | |
float humidity = dht.readHumidity(); | |
float temperature = dht.readTemperature(); | |
float hic = dht.computeHeatIndex(temperature, humidity, false); | |
Serial.print("waterlevel: "); | |
Serial.print(waterlevel); | |
Serial.print(" humidity: "); | |
Serial.print(humidity); | |
Serial.print(" temperature: "); | |
Serial.print(temperature); | |
Serial.print(" hic: "); | |
Serial.println(hic); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment