Could anyone help me with the code? It says that 'TimerMode' was not declared in this scope.
type or paste code here
````#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
BlynkTimer timer;
#include "DHT.h"
#define DHTTYPE DHT11
#define DHTPIN 4
DHT dht(DHTPIN, DHTTYPE);
char auth[] = "YourAuthToken";
char ssid[] = "YourNextworkName";
char pass[] = "YourPassword";
#include <TridentTD_LineNotify.h>
#define LINE_TOKEN "YourLineNotifyToken"
#define WATER_PUMP 23
#define SoilSensor 34
const int dry = 3800;
const int wet = 700;
int moistLevel;
bool mode1, mode2, mode3 = false;
int AmountWater, TIMER, Emerge;
bool notice = false;
bool notice1,notice2, notice3, notice4 = false;
int *SettingTime;
bool watering = false;
BLYNK_WRITE(V0) {
int Mode = param.asInt();
switch (Mode) {
case 1: {
LINE.notify("MANUAL MODE");
mode1 = false;
mode2 = true;
mode3 = false;
}
break;
}
}
BLYNK_WRITE(V1) {
int Manual = param.asInt();
AmountWater = Manual;
}
BLYNK_WRITE(V2) {
int SettingTime = param.asInt();
TIMER = SettingTime;
}
BLYNK_WRITE(V3) {
int EmergeNotify = param.asInt();
Emerge = EmergeNotify;
}
void sendHT() {
float TempC = dht.readTemperature();
float Humid = dht.readHumidity();
if (isnan(Humid) || isnan(TempC)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
Blynk.virtualWrite(V4, TempC);
Blynk.virtualWrite(V5, Humid);
}
void MoistMapping() {
int moistVal = analogRead(SoilSensor);
Serial.print(moistVal);
Serial.print(" = ");
moistLevel = map(moistVal, wet, dry, 100, 0);
Serial.print(moistLevel);
Serial.println("%");
Blynk.virtualWrite(V6, moistLevel);
}
void Emergency() {
unsigned long time_Emerge = 0;
int IntervalEmerge = 60000;
digitalWrite(WATER_PUMP, HIGH);
if (moistLevel <= 15 && notice == false) {
LINE.notifySticker(2, 34);
LINE.notify("Your plant is dehydrated!!");
LINE.notify("Please water your plant");
notice = true;
}
else if ( millis() - time_Emerge > IntervalEmerge && notice == true) {
time_Emerge = millis();
LINE.notify("EMERGENCY ALERT!!");
LINE.notify("Your plant is getting urgent rescue");
if (moistLevel < 50) {
digitalWrite(WATER_PUMP, LOW);
delay(1000);
digitalWrite(WATER_PUMP, HIGH);
delay(1000);
}
LINE.notify("I've just water your plant a little bit");
notice = false;
}
}
void ManualMode() {
bool work = false;
if (work == false && AmountWater > 0) {
LINE.notify("Your plant is hydrating");
digitalWrite(WATER_PUMP, LOW);
int DM = AmountWater * 100;
delay(DM);
digitalWrite(WATER_PUMP, HIGH);
AmountWater = 0;
if (moistLevel <= 80) {
LINE.notify("Done your work");
work = true;
}
else if (moistLevel > 80 && moistLevel < 90) {
LINE.notify("Your plant is almost fully hydrated by yourself");
work = true;
}
else if (moistLevel >= 90) {
LINE.notify("Your plant is fully hydrated by yourself");
work = true;
}
}
else {
digitalWrite(WATER_PUMP, HIGH);
}
}
void AutoMode() {
if (moistLevel <= 20 && watering == false) {
LINE.notify("Your plant is hydrating");
watering = true;
}
else if (moistLevel < 90 && watering == true) {
digitalWrite(WATER_PUMP, HIGH);
delay(1000);
digitalWrite(WATER_PUMP, LOW);
delay(1000);
}
else if (moistLevel >= 90 && watering == true) {
LINE.notify("Your planet is hydrated by ME :)");
digitalWrite(WATER_PUMP, LOW);
watering = false;
}
else {
digitalWrite(WATER_PUMP, HIGH);
}
}
void setup() {
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
LINE.setToken(LINE_TOKEN);
dht.begin();
timer.setInterval(1000L, sendHT);
timer.setInterval(1000L, MoistMapping);
pinMode(WATER_PUMP, OUTPUT);
}
void loop() {
timer.run();
Blynk.run();
if (mode1 == true) {
ManualMode();
if (Emerge == 1) {
Emergency();
}
}
else if (mode2 == true) {
TimerMode();
if (Emerge == 1) {
Emergency();
}
}
else if (mode3 == true) {
AutoMode();
}
else {
digitalWrite(WATER_PUMP, HIGH);
}
delay(1000);
}`