Hi!
After finding a ESP WROOM 32 DEV KIT in my sock draw, I thought of a little project for feeding and giving controlled light with UV and IR LEDs ect to my chilli plants.
As I have 3 plants and would like to use several analog inputs and outputs for this a D! mini wouldn’t be sufficient and the ESP32 would be perfect.
I have give it a quick test using several capacitive soil moisture sensors and I can’t get it to read a value at all! but if I try a sketch that doesn’t use Blynk and just reads through the analog pin and shows the values on the serial monitor, they all work fine.
I just don’t understand why I can’t get it to work through Blynk. is it me? as I am a complete novice. Is it the ESP32 giving me some payback for locking it in a sock draw for god knows how long? or is it that they just don’t work with Blynk?
Here is the code for just trying to read from one capacitive soil sensor…
#define BLYNK_PRINT Serial
int Soil1 = 15;
int Soil2 = 2;
int output_value;
int moisturelevel;
const long eventTime_soil1 = 1000;
unsigned long previousTime_1 = 0;
#include <Wire.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "***********************************";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "****************";
char pass[] = "***********";
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
Blynk.run();
soil1();
}
void soil1(){
output_value = analogRead(Soil1);
moisturelevel = constrain ( map(output_value, 1000, 4095, 100, 0), 0, 100);
unsigned long currentTime = millis();
if ( currentTime - previousTime_1 >= eventTime_soil1) {
Blynk.virtualWrite(V1, moisturelevel );
previousTime_1 = currentTime;
}
// Blynk.virtualWrite(V1, Soil1);
}
void soil2()
{
}