A function-definition is not allowed here before '{' token and Multiple libraries were found for "ArduinoJson.h"

//=============================================
// Changelog
//=============================================
/*

   v0.0.1
        Adding Switch Funtion


   v0.0.2

        flow Sensor
        Irrigation pressur Sensor
        Irr mode QTY


   V0.0.3
         Adding Fertigation


*/


#define VERSION "0.0.2"
//===========================================
// Includes
//===========================================
#include <ArduinoJson.h>
#include <FlowMeter.h>  // https://github.com/sekdiy/FlowMeter
#include <millisDelay.h>
#include <ArduinoJson.h>
#include <Arduino.h>
/*#include <RTClib.h>*/
#include <Time.h>
#include <TimeLib.h>
//////RTC
/*RTC_DS3231 rtc;*/
int minn;
int miny;
int secok;
bool okk = true;
/*int RTC_Hr ;
  int RTC_Min  ;
  ////***************/////
///Doser Input values
int Urea_fertilizer ;
int MOP_fertilizer ;
int DOP_fertilizer ;
int Acid_fertilizer ;
int MN_fertilizer ;

float per_nitrogen ;
float per_P ;
float per_K ;
float per_Acid ;
float per_MN ;

float Req_NutrientKg;
float Req_K_Kg ;
float Req_P_Kg;
float Req_Acid_Kg ;
float Req_MN_Kg ;
float Zone_sizein_acre;
long int  Nutrient_tank ;
long int ttHr ;
////bool variables for dosing
bool nutreintstats = false;
bool pstats = false;
bool kstats = false;
bool mstats = true;
bool astats = true;
//////dosing total time in mills
long int  totalnitromills;
long int  totalphsmills;
long int  totalpotamills;
//==================================
// Defines
//=================================

millisDelay ledDelay;
millisDelay DoserPh_Delay;
millisDelay DoserA_Delay;
millisDelay DoserB_Delay;
millisDelay DoserC_Delay;
millisDelay DoserAcid_Delay;

millisDelay AUTO_DoserPh_Delay; //AUTO_DoserA_Delay
millisDelay AUTO_DoserA_Delay;
millisDelay AUTO_DoserB_Delay;
millisDelay AUTO_DoserC_Delay;
millisDelay AUTO_DoserAcid_Delay;
#define MainInPressure_Pin    A1
#define IRR_InLetFlow 2
#define IRR_OutLetFlow 3

#define IRR_Pump_Zone01 12
#define IRR_Pump_Zone02 13
#define IRR_Pump_Zone03 11
#define IRR_Pump_Zone04 10

#define IRR_MainLine_SolVal 33
#define IRR_MainLine_SumpPump 12

#define ms_per_hour  3600000
#define ms_per_min    60000//
#define ms_per_sec    1000

#define Dose_pHUp_sol_pin 12
#define Dose_A_sol_pin 13
#define Dose_B_sol_pin 14
#define Dose_C_sol_pin 15
#define Dose_Acid_sol_pin 16
#define BooosPump_pin 17

#define Relay_ON LOW
#define Relay_OFF HIGH
int relayState;
int InFlowRateMin ;

int InFlowTotalVolume;
int SetVal_IrrValume;
//////
#define zone1relay 20

void sendData(String );


// set the measurement update period to 1s (1000 ms)
const unsigned long period = 1000;

float appdepth ;//= 0.11811;// inch -ET mm/day mm/25.4;
float flowrate ;//= 79.155;//gpm
float irrareaacre;//= 1.00;//acres000000000000
float appmin, apphour, watersupplied, irrareasqft;

bool PumpStatus;
long minToMilliSec;
bool ZPumpStatus;

String dfd;
char buff[1000];
String feedBack;
uint8_t otHr;
uint8_t otMin;
uint8_t oftMin;
uint8_t oftHr;
String str;
bool DurationIrrbool;

float flowrate1;
float driper;
float dripline;
float   etvalue;
int hours_minutes;
float Irrigation_time;
float DWR_Val_ha;
int looping = 0;
float P_rate;

//===========================================
// Flag Defines
//===========================================

bool IrrMode_Qty_bool;
bool DurationIrr_bool;
bool DepthIrrMode_bool;

bool DepthIrrMode_shift01 = false;
bool DepthIrrMode_shift02;
bool DepthIrrMode_shift03;
bool Doser_bool;
bool Doser_pH_Enable;
bool Doser_A_Enable;
bool Doser_B_Enable;
bool Doser_C_Enable;
bool Doser_Acid_Enable;
bool Doser_pH_bool;
bool Doser_A_bool;

unsigned long delayStart = 0; // the time the delay started
bool delayRunning = false;

unsigned long DoserPh_DelayTime;
unsigned long DoserA_DelayTime;
unsigned long DoserB_DelayTime;
unsigned long DoserC_DelayTime ;
unsigned long long DoserAcid_DelayTime;
//===========================================
// Sensor Defines
//===========================================
const float  OffSet = 0.483 ;
float V, Pressure;

// connect a flow meter to an interrupt pin (see notes on your Arduino model for pin numbers)
FlowMeter *Meter1;
FlowMeter *Meter2;
//===========================================
// Json Defines
//===========================================
DynamicJsonDocument doc(1024);
DynamicJsonDocument megadoc(1024);

StaticJsonDocument<200> doc1;

bool postionstatus;

//===========================================
// Single OnRelay Switcher
//===========================================
void nexval()
{

  StaticJsonDocument<256> doc;

  DeserializationError error = deserializeJson(doc, Serial3);

  if (error) {

    return;
  }

  JsonObject Allrelays = doc["Allrelays"];
  int Allrelays_id = Allrelays["id"];
  int Allrelays_SMV = Allrelays["SMV"];
  int Allrelays_SMP = Allrelays["SMP"];
  int Allrelays_SMV_2 = Allrelays["SMV_2"];
  int Allrelays_SMP_2 = Allrelays["SMP_2"];
  int Allrelays_TEMPC = Allrelays["TEMPC"];
  int Allrelays_Temp = Allrelays["Temp"];
  int Allrelays_Humi = Allrelays["Humi"];
  int Allrelays_PRE = Allrelays["PRE"];
  int Allrelays_Lat = Allrelays["Lat"];
  int Allrelays_Lon = Allrelays["Lon"];
  int Allrelays_NI = Allrelays["NI"];
  int Allrelays_PH = Allrelays["PH"];
  int Allrelays_POT = Allrelays["POT"];
  int Allrelays_LAT = Allrelays["LAT"];
  int Allrelays_LON = Allrelays["LON"];
  Serial.print("Allrelays_SMV");
  Serial.println(Allrelays_SMV);

  if (Allrelays_SMV > 0)
  {
    Serial2.print("g0.txt=\"");
    Serial2.print(Allrelays_id);
    Serial2.print("\"");
    Serial2.write(0x03ff);
    Serial2.write(0x03ff);
    Serial2.write(0x03ff);


    Serial2.print("n1.txt=\"");
    Serial2.print(Allrelays_NI);
    Serial2.print("\"");
    Serial2.write(0x03ff);
    Serial2.write(0x03ff);
    Serial2.write(0x03ff);

    Serial2.print("p1.txt=\"");
    Serial2.print(Allrelays_PH);
    Serial2.print("\"");
    Serial2.write(0x03ff);
    Serial2.write(0x03ff);
    Serial2.write(0x03ff);

    Serial2.print("k1.txt=\"");
    Allrelays_POT = sqrt(( Allrelays_POT) * (Allrelays_POT));
    Serial2.print(Allrelays_POT);
    Serial2.print("\"");
    Serial2.write(0x03ff);
    Serial2.write(0x03ff);
    Serial2.write(0x03ff);

    Serial2.print("ph1.txt=\"");
    Serial2.print(Allrelays_Lat);
    Serial2.print("\"");
    Serial2.write(0x3ff);
    Serial2.write(0x03ff);
    Serial2.write(0x03ff);

    Serial2.print("ec1.txt=\"");
    Serial2.print(Allrelays_Lon);
    Serial2.print("\"");
    Serial2.write(0x03ff);
    Serial2.write(0x03ff);
    Serial2.write(0x03ff);

    Serial2.print("sm11.txt=\"");
    Serial2.print(Allrelays_SMV);
    Serial2.print("\"");
    Serial2.write(0x03ff);
    Serial2.write(0x03ff);
    Serial2.write(0x03ff);

    Serial2.print("sm21.txt=\"");
    Serial2.print(Allrelays_SMV_2);
    Serial2.print("\"");
    Serial2.write(0x03ff);
    Serial2.write(0x03ff);
    Serial2.write(0x03ff);

    Serial2.print("st1.txt=\"");
    Serial2.print(Allrelays_TEMPC);
    Serial2.print("\"");
    Serial2.write(0x03ff);
    Serial2.write(0x03ff);
    Serial2.write(0x03ff);

    Serial2.print("at1.txt=\"");
    Serial2.print(Allrelays_Temp);
    Serial2.print("\"");
    Serial2.write(0x03ff);
    Serial2.write(0x03ff);
    Serial2.write(0x03ff);

  }
}
class SingleOnRelaySwitcher
{
    // class member variables
    byte relayPin; // number of pin for relay
    long OnTime;
    long OffTime;
    int relayState; // set relay state (active HIGH)
    unsigned long previousMillis; // set time since last update
  public:
    SingleOnRelaySwitcher(byte pin)
    {
      relayPin = pin;
    }
    void begin( long long int  on, bool StatusOfRelay)
    {
      PumpStatus = StatusOfRelay;
      pinMode(relayPin, OUTPUT);
      OnTime = on;
      relayState = HIGH;
      previousMillis = 0;
    }
    void Update()
    {
      Serial.println("okwe");
      unsigned long currentMillis = millis();
      if ((relayState == HIGH) && (currentMillis - previousMillis < OnTime ))
      {
        relayState = LOW; // Turn it off
        Serial.println("relay ON");
        previousMillis = currentMillis; // Remember the time
        digitalWrite(relayPin, relayState); //update the relay
        PumpStatus = true;
      }
      else if ((relayState == LOW) && (currentMillis - previousMillis > OnTime))
      {
        PumpStatus = false;
        ZPumpStatus = false;
        Doser_pH_bool = false;
        relayState = HIGH ; // turn it on
        previousMillis = currentMillis;
        Serial.println("relay OFF");
        digitalWrite(relayPin, relayState);

      }
    }
};
SingleOnRelaySwitcher Zone01_MainLinePump(zone1relay);

bool Shift01() {

}

void Meter1ISR() {
  // let our flow meter count the pulses
  Meter1->count();
}

// define an 'interrupt service handler' (ISR) for every interrupt pin you use
void Meter2ISR() {
  // let our flow meter count the pulses
  Meter2->count();
}
int led = 13;
//===========================================
// setup
//===========================================
void setup() {
  // put your setup code here, to run once:

  Serial.begin(115200);
  Serial2.begin(9600);
  Serial3.begin(115200);
  pinMode(IRR_Pump_Zone01, OUTPUT);
  digitalWrite(IRR_Pump_Zone01, HIGH);
  pinMode(IRR_MainLine_SolVal, OUTPUT);
  digitalWrite(IRR_MainLine_SolVal, HIGH);
  digitalWrite(IRR_MainLine_SumpPump, HIGH);

  pinMode(BooosPump_pin, OUTPUT);
  digitalWrite(BooosPump_pin, HIGH);
  pinMode(Dose_pHUp_sol_pin, OUTPUT);
  digitalWrite(Dose_pHUp_sol_pin, HIGH);
  pinMode(Dose_A_sol_pin, OUTPUT);
  digitalWrite(Dose_A_sol_pin, HIGH);
  pinMode(Dose_B_sol_pin, OUTPUT);
  digitalWrite(Dose_B_sol_pin, HIGH);
  pinMode(Dose_C_sol_pin, OUTPUT);
  digitalWrite(Dose_C_sol_pin, HIGH);
  pinMode(Dose_Acid_sol_pin, OUTPUT);
  digitalWrite(Dose_Acid_sol_pin, HIGH);

  pinMode(IRR_InLetFlow, INPUT_PULLUP);
  pinMode(IRR_OutLetFlow, INPUT_PULLUP);

  pinMode(led, OUTPUT);   // initialize the digital pin as an output.
  digitalWrite(led, HIGH); // turn led on


  // get a new FlowMeter instance for an uncalibrated flow sensor and let them attach their 'interrupt service handler' (ISR) on every rising edge
  Meter1 = new FlowMeter(digitalPinToInterrupt(IRR_InLetFlow), UncalibratedSensor, Meter1ISR, RISING);

  // do this setup step for every  FlowMeter and ISR you have defined, depending on how many you need
  Meter2 = new FlowMeter(digitalPinToInterrupt(IRR_OutLetFlow), UncalibratedSensor, Meter2ISR, RISING);



}
void ok()
{
  deserializeJson(doc, Serial3);
  DeserializationError error = deserializeJson(doc, Serial3);

  if (error)
  {
    return;
  }

  const char* Dayy = doc["Dayy"]; // "Wednesday"
  int  hourss = doc["hourss"]; // 12
  int minutess = doc["minutess"]; // 58
  int secondss = doc["secondss"]; // 5

  if ((secondss > 0) && (ok == true))
    /* {
       rtc.begin();
       rtc.adjust(DateTime(2022, 9, 17, hourss, minutess, secondss));
       ok == false;
      }


      }*/

    /*void rtcupdte()
      {
      DateTime now = rtc.now();
      RTC_Hr = now.hour();
      RTC_Min = now.minute();
      if (RTC_Hr >= 12)
      {
        RTC_Hr = RTC_Hr - 12;
      }
      secok = now.second();
      }*/
    void Qty_Doser_setup()
  {
    DoserPh_DelayTime = ms_per_sec * 10;
    DoserA_DelayTime = totalnitromills;
    DoserB_DelayTime = totalpotamills;
    DoserC_DelayTime = totalphsmills;
    unsigned long long DoserAcid_DelayTime = ms_per_sec * 60;
    if ((Doser_bool == true) && (Doser_A_Enable == true))
    {
      Serial.println("innitrogen");
      AUTO_DoserA_Delay.start(DoserA_DelayTime);

      if (AUTO_DoserA_Delay.isRunning()) {
        digitalWrite(Dose_A_sol_pin , LOW);
        Serial.println("we are in on state");
      }
      else {
        Serial.println("we are in off state");
        digitalWrite(Dose_A_sol_pin , HIGH);
      }
    }

    if ((Doser_bool == true) && (Doser_B_Enable == true))
    {
      Serial.println("PHSPRS");
      AUTO_DoserB_Delay.start(DoserB_DelayTime);
      if (AUTO_DoserB_Delay.isRunning()) {
        digitalWrite(Dose_B_sol_pin , LOW);
        Serial.println("we are in on state");
      }
      else {
        Serial.println("we are in off state");
        digitalWrite(Dose_B_sol_pin , HIGH);
      }
    }
    if ((Doser_bool == true) && (Doser_C_Enable == true))
    {

      Serial.println("POTASSIUM");
      AUTO_DoserC_Delay.start(DoserC_DelayTime);
      if (AUTO_DoserC_Delay.isRunning()) {
        digitalWrite(Dose_C_sol_pin  , LOW);
        Serial.println("we are in on state");
      }
      else {
        Serial.println("we are in off state");
        digitalWrite(Dose_C_sol_pin  , HIGH);
      }
    }
  }



  void irr()
  {
    if ((looping <= 5) && (Irrigation_time > 1))
    {
      zone1();
      looping++;
    }
    unsigned long maxy = millis();
    if (maxy - miny > 5000)
    {
      miny = maxy;
      rtcupdte();
      DepthIrrMode();


    }
    unsigned long maxx = millis();
    if (maxx - minn > 3000)
    {
      minn = maxx;
      ok();

    }

  }
  //===========================================
  // Loop
  //===========================================
  void loop()
  {
    //  SerialCom();
    //  irr();
    //  delay(3000);
    //  Qty_Doser_setup();
   
    nexval();
  }

Please edit your post, select all code and click the </> button; next save your post.

Read the forum guidelines to see how to properly post code and some good information on making a good post.

Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Please go back and fix your original post.

Please include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.

Most probably you have a missing '}' before that function definition.
Therefore, the compiler sees you define a function within another function. That is not allowed.
Press ctrl-t to properly align your code. That should help you to find the place where it is missing...

I press ctrl-t but its displaying no changes to auto format.

Please edit your message and add code tags to it!
Please show the error message in full

Now I have edit the code and show the e//=============================================
// Changelog
//=============================================
/*

   v0.0.1
        Adding Switch Funtion


   v0.0.2

        flow Sensor
        Irrigation pressur Sensor
        Irr mode QTY


   V0.0.3
         Adding Fertigation


*/


#define VERSION "0.0.2"
//===========================================
// Includes
//===========================================
#include <ArduinoJson.h>
#include <FlowMeter.h>  // https://github.com/sekdiy/FlowMeter
#include "millisDelay.h"
#include <ArduinoJson.h>
#include <Arduino.h>
#include <RTClib.h>
#include <Time.h>
#include <TimeLib.h>
//////RTC
RTC_DS3231 rtc;
int minn;
int miny;
int secok;
bool okk = true;
int RTC_Hr ;
int RTC_Min  ;
////***************/////
///Doser Input values
int Urea_fertilizer ;
int MOP_fertilizer ;
int DOP_fertilizer ;
int Acid_fertilizer ;
int MN_fertilizer ;

float per_nitrogen ;
float per_P ;
float per_K ;
float per_Acid ;
float per_MN ;

float Req_NutrientKg;
float Req_K_Kg ;
float Req_P_Kg;
float Req_Acid_Kg ;
float Req_MN_Kg ;
float Zone_sizein_acre;
long int  Nutrient_tank ;
long int ttHr ;
////bool variables for dosing
bool nutreintstats = false;
bool pstats = false;
bool kstats = false;
bool mstats = true;
bool astats = true;
//////dosing total time in mills
long int  totalnitromills;
long int  totalphsmills;
long int  totalpotamills;
//==================================
// Defines
//=================================

millisDelay ledDelay;
millisDelay DoserPh_Delay;
millisDelay DoserA_Delay;
millisDelay DoserB_Delay;
millisDelay DoserC_Delay;
millisDelay DoserAcid_Delay;

millisDelay AUTO_DoserPh_Delay; //AUTO_DoserA_Delay
millisDelay AUTO_DoserA_Delay;
millisDelay AUTO_DoserB_Delay;
millisDelay AUTO_DoserC_Delay;
millisDelay AUTO_DoserAcid_Delay;
#define MainInPressure_Pin    A1
#define IRR_InLetFlow 2
#define IRR_OutLetFlow 3

#define IRR_Pump_Zone01 12
#define IRR_Pump_Zone02 13
#define IRR_Pump_Zone03 11
#define IRR_Pump_Zone04 10

#define IRR_MainLine_SolVal 33
#define IRR_MainLine_SumpPump 12

#define ms_per_hour  3600000
#define ms_per_min    60000//
#define ms_per_sec    1000

#define Dose_pHUp_sol_pin 12
#define Dose_A_sol_pin 13
#define Dose_B_sol_pin 14
#define Dose_C_sol_pin 15
#define Dose_Acid_sol_pin 16
#define BooosPump_pin 17

#define Relay_ON LOW
#define Relay_OFF HIGH
int relayState;
int InFlowRateMin ;

int InFlowTotalVolume;
int SetVal_IrrValume;
//////
#define zone1relay 20

void sendData(String );


// set the measurement update period to 1s (1000 ms)
const unsigned long period = 1000;

float appdepth ;//= 0.11811;// inch -ET mm/day mm/25.4;
float flowrate ;//= 79.155;//gpm
float irrareaacre;//= 1.00;//acres000000000000
float appmin, apphour, watersupplied, irrareasqft;

bool PumpStatus;
long minToMilliSec;
bool ZPumpStatus;

String dfd;
char buff[1000];
String feedBack;
uint8_t otHr;
uint8_t otMin;
uint8_t oftMin;
uint8_t oftHr;
String str;
bool DurationIrrbool;

float flowrate1;
float driper;
float dripline;
float   etvalue;
int hours_minutes;
float Irrigation_time;
float DWR_Val_ha;
int looping = 0;
float P_rate;

//===========================================
// Flag Defines
//===========================================

bool IrrMode_Qty_bool;
bool DurationIrr_bool;
bool DepthIrrMode_bool;

bool DepthIrrMode_shift01 = false;
bool DepthIrrMode_shift02;
bool DepthIrrMode_shift03;
bool Doser_bool;
bool Doser_pH_Enable;
bool Doser_A_Enable;
bool Doser_B_Enable;
bool Doser_C_Enable;
bool Doser_Acid_Enable;
bool Doser_pH_bool;
bool Doser_A_bool;

unsigned long delayStart = 0; // the time the delay started
bool delayRunning = false;

unsigned long DoserPh_DelayTime;
unsigned long DoserA_DelayTime;
unsigned long DoserB_DelayTime;
unsigned long DoserC_DelayTime ;
unsigned long long DoserAcid_DelayTime;
//===========================================
// Sensor Defines
//===========================================
const float  OffSet = 0.483 ;
float V, Pressure;

// connect a flow meter to an interrupt pin (see notes on your Arduino model for pin numbers)
FlowMeter *Meter1;
FlowMeter *Meter2;
//===========================================
// Json Defines
//===========================================
DynamicJsonDocument doc(1024);
DynamicJsonDocument megadoc(1024);

StaticJsonDocument<200> doc1;

bool postionstatus;

//===========================================
// Single OnRelay Switcher
//===========================================
void nexval()
{
 
  StaticJsonDocument<256> doc;

  DeserializationError error = deserializeJson(doc, Serial3);

  if (error) {
   
    return;
  }

  JsonObject Allrelays = doc["Allrelays"];
  int Allrelays_id = Allrelays["id"];
  int Allrelays_SMV = Allrelays["SMV"];
  int Allrelays_SMP = Allrelays["SMP"];
  int Allrelays_SMV_2 = Allrelays["SMV_2"];
  int Allrelays_SMP_2 = Allrelays["SMP_2"];
  int Allrelays_TEMPC = Allrelays["TEMPC"];
  int Allrelays_Temp = Allrelays["Temp"];
  int Allrelays_Humi = Allrelays["Humi"];
  int Allrelays_PRE = Allrelays["PRE"];
  int Allrelays_Lat = Allrelays["Lat"];
  int Allrelays_Lon = Allrelays["Lon"];
  int Allrelays_NI = Allrelays["NI"];
  int Allrelays_PH = Allrelays["PH"];
  int Allrelays_POT = Allrelays["POT"];
  int Allrelays_LAT = Allrelays["LAT"];
  int Allrelays_LON = Allrelays["LON"];
Serial.print("Allrelays_SMV");
Serial.println(Allrelays_SMV);

  if(Allrelays_SMV>0)
  {
  Serial2.print("g0.txt=\"");
  Serial2.print(Allrelays_id);
  Serial2.print("\"");
  Serial2.write(0x03ff);
  Serial2.write(0x03ff);
  Serial2.write(0x03ff);


  Serial2.print("n1.txt=\"");
  Serial2.print(Allrelays_NI);
  Serial2.print("\"");
  Serial2.write(0x03ff);
  Serial2.write(0x03ff);
  Serial2.write(0x03ff);

  Serial2.print("p1.txt=\"");
  Serial2.print(Allrelays_PH);
  Serial2.print("\"");
  Serial2.write(0x03ff);
  Serial2.write(0x03ff);
  Serial2.write(0x03ff);

  Serial2.print("k1.txt=\"");
  Allrelays_POT = sqrt(( Allrelays_POT) * (Allrelays_POT));
  Serial2.print(Allrelays_POT);
  Serial2.print("\"");
  Serial2.write(0x03ff);
  Serial2.write(0x03ff);
  Serial2.write(0x03ff);

  Serial2.print("ph1.txt=\"");
  Serial2.print(Allrelays_Lat);
  Serial2.print("\"");
  Serial2.write(0x3ff);
  Serial2.write(0x03ff);
  Serial2.write(0x03ff);

  Serial2.print("ec1.txt=\"");
  Serial2.print(Allrelays_Lon);
  Serial2.print("\"");
  Serial2.write(0x03ff);
  Serial2.write(0x03ff);
  Serial2.write(0x03ff);

  Serial2.print("sm11.txt=\"");
  Serial2.print(Allrelays_SMV);
  Serial2.print("\"");
  Serial2.write(0x03ff);
  Serial2.write(0x03ff);
  Serial2.write(0x03ff);

  Serial2.print("sm21.txt=\"");
  Serial2.print(Allrelays_SMV_2);
  Serial2.print("\"");
  Serial2.write(0x03ff);
  Serial2.write(0x03ff);
  Serial2.write(0x03ff);

  Serial2.print("st1.txt=\"");
  Serial2.print(Allrelays_TEMPC);
  Serial2.print("\"");
  Serial2.write(0x03ff);
  Serial2.write(0x03ff);
  Serial2.write(0x03ff);

  Serial2.print("at1.txt=\"");
  Serial2.print(Allrelays_Temp);
  Serial2.print("\"");
  Serial2.write(0x03ff);
  Serial2.write(0x03ff);
  Serial2.write(0x03ff);

  }
}
class SingleOnRelaySwitcher
{
    // class member variables
    byte relayPin; // number of pin for relay
    long OnTime;
    long OffTime;
    int relayState; // set relay state (active HIGH)
    unsigned long previousMillis; // set time since last update
  public:
    SingleOnRelaySwitcher(byte pin)
    {
      relayPin = pin;
    }
    void begin( long long int  on, bool StatusOfRelay)
    {
      PumpStatus = StatusOfRelay;
      pinMode(relayPin, OUTPUT);
      OnTime = on;
      relayState = HIGH;
      previousMillis = 0;
    }
    void Update()
    {
      Serial.println("okwe");
      unsigned long currentMillis = millis();
      if ((relayState == HIGH) && (currentMillis - previousMillis < OnTime ))
      {
        relayState = LOW; // Turn it off
        Serial.println("relay ON");
        previousMillis = currentMillis; // Remember the time
        digitalWrite(relayPin, relayState); //update the relay
        PumpStatus = true;
      }
      else if ((relayState == LOW) && (currentMillis - previousMillis > OnTime))
      {
        PumpStatus = false;
        ZPumpStatus = false;
        Doser_pH_bool = false;
        relayState = HIGH ; // turn it on
        previousMillis = currentMillis;
        Serial.println("relay OFF");
        digitalWrite(relayPin, relayState);

      }
    }
};
SingleOnRelaySwitcher Zone01_MainLinePump(zone1relay);

bool Shift01() {

}

void Meter1ISR() {
  // let our flow meter count the pulses
  Meter1->count();
}

// define an 'interrupt service handler' (ISR) for every interrupt pin you use
void Meter2ISR() {
  // let our flow meter count the pulses
  Meter2->count();
}
int led = 13;
//===========================================
// setup
//===========================================
void setup() {
  // put your setup code here, to run once:

  Serial.begin(115200);
  Serial2.begin(9600);
  Serial3.begin(115200);
  pinMode(IRR_Pump_Zone01, OUTPUT);
  digitalWrite(IRR_Pump_Zone01, HIGH);
  pinMode(IRR_MainLine_SolVal, OUTPUT);
  digitalWrite(IRR_MainLine_SolVal, HIGH);
  digitalWrite(IRR_MainLine_SumpPump, HIGH);

  pinMode(BooosPump_pin, OUTPUT);
  digitalWrite(BooosPump_pin, HIGH);
  pinMode(Dose_pHUp_sol_pin, OUTPUT);
  digitalWrite(Dose_pHUp_sol_pin, HIGH);
  pinMode(Dose_A_sol_pin, OUTPUT);
  digitalWrite(Dose_A_sol_pin, HIGH);
  pinMode(Dose_B_sol_pin, OUTPUT);
  digitalWrite(Dose_B_sol_pin, HIGH);
  pinMode(Dose_C_sol_pin, OUTPUT);
  digitalWrite(Dose_C_sol_pin, HIGH);
  pinMode(Dose_Acid_sol_pin, OUTPUT);
  digitalWrite(Dose_Acid_sol_pin, HIGH);

  pinMode(IRR_InLetFlow, INPUT_PULLUP);
  pinMode(IRR_OutLetFlow, INPUT_PULLUP);

  pinMode(led, OUTPUT);   // initialize the digital pin as an output.
  digitalWrite(led, HIGH); // turn led on


  // get a new FlowMeter instance for an uncalibrated flow sensor and let them attach their 'interrupt service handler' (ISR) on every rising edge
  Meter1 = new FlowMeter(digitalPinToInterrupt(IRR_InLetFlow), UncalibratedSensor, Meter1ISR, RISING);

  // do this setup step for every  FlowMeter and ISR you have defined, depending on how many you need
  Meter2 = new FlowMeter(digitalPinToInterrupt(IRR_OutLetFlow), UncalibratedSensor, Meter2ISR, RISING);



}
void ok()
{
  deserializeJson(doc, Serial3);
  DeserializationError error = deserializeJson(doc, Serial3);

  if (error)
  {
    return;
  }

  const char* Dayy = doc["Dayy"]; // "Wednesday"
  int  hourss = doc["hourss"]; // 12
  int minutess = doc["minutess"]; // 58
  int secondss = doc["secondss"]; // 5

  if ((secondss > 0) && (okk == true))
  {
    rtc.begin();
    rtc.adjust(DateTime(2022, 9, 17, hourss, minutess, secondss));
    okk == false;
  }


}

void rtcupdte()
{
  DateTime now = rtc.now();
  RTC_Hr = now.hour();
  RTC_Min = now.minute();
  if (RTC_Hr >= 12)
  {
    RTC_Hr = RTC_Hr - 12;
  }
  secok = now.second();
}
void Qty_Doser_setup()
{
  DoserPh_DelayTime = ms_per_sec * 10;
  DoserA_DelayTime = totalnitromills;
  DoserB_DelayTime = totalpotamills;
  DoserC_DelayTime = totalphsmills;
  unsigned long long DoserAcid_DelayTime = ms_per_sec * 60;
  if ((Doser_bool == true) && (Doser_A_Enable == true))
  {
    Serial.println("innitrogen");
    AUTO_DoserA_Delay.start(DoserA_DelayTime);

    if (AUTO_DoserA_Delay.isRunning()) {
      digitalWrite(Dose_A_sol_pin , LOW);
      Serial.println("we are in on state");
    }
    else {
      Serial.println("we are in off state");
      digitalWrite(Dose_A_sol_pin , HIGH);
    }
  }

  if ((Doser_bool == true) && (Doser_B_Enable == true))
  {
    Serial.println("PHSPRS");
    AUTO_DoserB_Delay.start(DoserB_DelayTime);
    if (AUTO_DoserB_Delay.isRunning()) {
      digitalWrite(Dose_B_sol_pin , LOW);
      Serial.println("we are in on state");
    }
    else {
      Serial.println("we are in off state");
      digitalWrite(Dose_B_sol_pin , HIGH);
    }
  }
  if ((Doser_bool == true) && (Doser_C_Enable == true))
  {

    Serial.println("POTASSIUM");
    AUTO_DoserC_Delay.start(DoserC_DelayTime);
    if (AUTO_DoserC_Delay.isRunning()) {
      digitalWrite(Dose_C_sol_pin  , LOW);
      Serial.println("we are in on state");
    }
    else {
      Serial.println("we are in off state");
      digitalWrite(Dose_C_sol_pin  , HIGH);
    }
  }
}



void irr()
{
  if ((looping <= 5) && (Irrigation_time > 1))
  {
    zone1();
    looping++;
  }
  unsigned long maxy = millis();
  if (maxy - miny > 5000)
  {
    miny = maxy;
    rtcupdte();
    DepthIrrMode();


  }
  unsigned long maxx = millis();
  if (maxx - minn > 3000)
  {
    minn = maxx;
    ok();

  }

}
//===========================================
// Loop
//===========================================
void loop()
{
//  SerialCom();
//  irr();
//  delay(3000);
//  Qty_Doser_setup();
  nexval();
}rror in full message please check the error guys.

Include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.

In file included from C:\Users\DELL\Desktop\Arduino\Tx_FIB_v0.0.4\Tx_FIB_v0.0.4.ino:33:0:
C:\Users\DELL\Documents\Arduino\libraries\RTClib-master\src/RTClib.h:25:10: fatal error: Adafruit_I2CDevice.h: No such file or directory
 #include <Adafruit_I2CDevice.h>
          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Arduino Mega or Mega 2560.

Now can anyone check the error?

looks like the RTC library is missing some components.

Did you install the AdafruityI2c thingy?

In file included from C:\Users\DELL\Desktop\Arduino\Tx_FIB_v0.0.4\Tx_FIB_v0.0.4.ino:33:0:
C:\Users\DELL\Documents\Arduino\libraries\RTClib-master\src/RTClib.h:25:10: fatal error: Adafruit_I2CDevice.h: No such file or directory
 #include <Adafruit_I2CDevice.h>
          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Arduino Mega or Mega 2560.
Invalid library found in C:\Program Files\Arduino\libraries\Adafruit_BusIO-master: no headers files (.h) found in C:\Program Files\Arduino\libraries\Adafruit_BusIO-master

After installed the library I got this error

C:\Users\DELL\Desktop\Arduino\Tx_FIB_v0.0.4\Tx_FIB_v0.0.4.ino: In function 'void irr()':
Tx_FIB_v0.0.4:518:5: error: 'zone1' was not declared in this scope
     zone1();
     ^~~~~
C:\Users\DELL\Desktop\Arduino\Tx_FIB_v0.0.4\Tx_FIB_v0.0.4.ino:518:5: note: suggested alternative: 'tone'
     zone1();
     ^~~~~
     tone
Tx_FIB_v0.0.4:526:5: error: 'DepthIrrMode' was not declared in this scope
     DepthIrrMode();
     ^~~~~~~~~~~~
C:\Users\DELL\Desktop\Arduino\Tx_FIB_v0.0.4\Tx_FIB_v0.0.4.ino:526:5: note: suggested alternative: 'DepthIrrMode_bool'
     DepthIrrMode();
     ^~~~~~~~~~~~
     DepthIrrMode_bool
exit status 1
'zone1' was not declared in this scope

Now I have reinstalled the library can anyone help me to decode this error :sob: :sob:

It is pretty clear... zone1() is never defined.
So, where is it?

Sometimes that means "An error elsewhere in your code caused the compiler to miss the declaration of this function." Look at all of the other error messages and see if there are any you can fix.

Okay Thankyou

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.