BlynkTimer error in a soil moisture code

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();

}
  • “sensorDataSend” has been defined twice, once as integer and once as function.
  • remove the ; from the function sensorDataSend();
1 Like

Hey, thanks for your help, really appreaciate it.

But if I remove the “;” from “void sensorDataSend” it gives me the following error:
‘void sensorDataSend()’ redeclared as different kind of symbol

And if I remove it from “int sensorDataSend” it gives me the following error:
expected ‘,’ or ‘;’ before ‘BlynkTimer’

Hope u can help me, thanks in advance.

Sorry if I didn’t understand what u meant as I said I am really new here.

  • Rename the function and change the function call in your Blynktimer to the new name.
  • remove the ; at the end of the first line of the renamed function.
  • invest some time in understanding the SW language you are using and it’s syntax.

Good luck.

1 Like

Thank you very much, I do really appreciate your help I’ll do it.

Too bad you ignored the advice given to you in your duplicate item. Never post the same issue twice.

1 Like

?

I posted it before you answered me.

If I would have seen the duplicate I would never have responded.

Sorry if I did ofend u man.

As I said im really new into all this shi and I dont know how to manage it I just need answers.

You were given the answer 3 days ago in your original topic, but chose to ignore it.

Pete.

Noticing you call your “very important school project” shi… says it all. Sad.

1 Like