Hey, I’ve been working in a very important school project lately, and I’m in a rush.
I need help with my code for a soil moisture sensor.
I do work with an esp32, I do think that the code is correct, it just gives me an error which I don’t understand why:
no matching function for call to ‘BlynkTimer::setInterval(long int, int&)’
I’ve also already installed the blynk library.
I really appreciate any help and advice as a newbie which I am.
I let you see my sketch here:
#define BLYNK_TEMPLATE_ID "TMPL5ENYgsRN5"
#define BLYNK_TEMPLATE_NAME "SENSOR HUMITAT"
#define BLYNK_AUTH_TOKEN "vrviGfLqh-OWNSSkBJC_TbH9wDa1lKIA"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <BlynkSimpleEsp32.h>
char auth[] = ("vrviGfLqh-OWNSSkBJC_TbH9wDa1lKIA");
const int sensorPin = 32;
int sensorState = 0;
int lastState = 0;
int sensorDataSend = 0;
BlynkTimer timer; //announcing timer
void setup()
{
Serial.begin(9600);
Blynk.begin(BLYNK_AUTH_TOKEN, "MOVISTAR_PLUS_8562", "FV9NHxMt5S9drH7Lo6u9"); //wifi name and password
pinMode(sensorPin, INPUT);
timer.setInterval(1000L, sensorDataSend);
}
void sensorDataSend();
{
sensorState = digitalRead(sensorPin);
Serial.println(sensorState);
if (sensorState== 1 && lastState == 0)
{
Serial.println("needs water, send notification");
Blynk.logEvent("test_event");
lastState = 1;
//send notification
}
else if (sensorState== 1 && lastState == 1)
{
//do nothing, has not been watered yet Serial.println("has not been watered yet"); delay(1000);
}
else
{
//st
Serial.println("does not need water");
lastState = 0;
}
}
void loop()
{
Blynk.run();
timer.run();
}