's1_pin' was not declared in this scope : another STUPID question

I think i asked so many silly questions in this forum... :grin:
and Here's an another one to add count

.

//------- VARIABLES FOR ENTERTING THE FLOWRATE-------\\

#define data_buffer_size 80
#define starting_character 'F'// we can change the Both starting and ending characters
#define ending_character '\r'

char delimiters[] ="F";  // Strtok() function depends on these delimiters we can change for various functions

char data_buffer[data_buffer_size+1]; //Add 1 for NULL terminator

boolean store_string = false; // storeString variable initialization which is used in the get_serial_string() function

//----------------   BOOLEAN CONSTANTS TO HOLD THE VALVE POSITIONS  ----------------------------\\
boolean s1_position = false;
boolean s2_position = false;
boolean s3_position = false;
boolean s4_position = false;
boolean s5_position = false;
boolean s6_position = false;
boolean s7_position = false;

//------------------------ PIN DECLARATION --------------------\\
#define s1_pin 3
#define s2_pin 4
#define s3_pin 5
#define s4_pin 6
#define s5_pin 7
#define s6_pin 8
#define s7_pin 9
#define st1_pin 10
#define st2_pin 11
#define tank_a_temp 13
#define tank_b_temp 14

//---------- FLOW RATE AND VOLUME DECLARATIONS ---------------------\\

int water_tank_flow_rate;
int water_volume;
int tank_a_flow_rate;
int tank_a_volume;
int tank_b_flow_rate;
int tank_b_volume;



void setup(){
  // START THE SERIAL COMMUNICATION
  Serial.begin(9600);//baud rate 9600 is better choice for lond cables < more distance less speed>
  Serial1.begin(9600);//Serial1 is used for communication between arduino Uno And arduino Mega

  //-------------------- PIN MODE DECLARATIONS -----------------------------\\
  //VALVE TO CONTROL THE FLOW BETWEEN TANKS
  pinMode(s1_pin,OUTPUT);
  pinMode(s2_pin,OUTPUT);
  pinMode(s3_pin,OUTPUT);
  pinMode(s4_pin,OUTPUT);
  pinMode(s5_pin,OUTPUT);
  pinMode(s6_pin,OUTPUT);
  pinMode(s7_pin,OUTPUT);

  //STIRRING CONTROL PINS
  pinMode(st1_pin,OUTPUT);
  pinMode(st2_pin,OUTPUT);

  // TEMPARATURE MEASUREMENT PINS
  pinMode(tank_a_temp,OUTPUT);
  pinMode(tank_b_temp,OUTPUT);


  //------------------ASK THE USER TO ENTER REQUIRED VARIABLES------------------\\

  Serial.println("PLEASE ENTER THE ALL FLOW RATE VALUES FOLLOWED BY F ------------->     EX:F12");
  Serial.println("");
  const String question_1 = ("Enter the volume flow rate of water tank in LTR/MIN");
  const String question_2 = ("Enter the quantity of water released into the Water Tank");
  const String question_3 = ("Enter the volume flow rate of Metering pump Connected to the Tank A in LTR/MIN");
  const String question_4 = ("Enter the Quantity of Solution released into the Reaction Tank From TANK - A in LTR's");
  const String question_5 = ("Enter the volume flow rate of Metering pump Connected to the Tank B in LTR/MIN");
  const String question_6 = ("Enter the Quantity of Solution released into the Reaction Tank From TANK - B in LTR's");
  ask_ques_get_res(question_1);
  water_tank_flow_rate = get_the_data(data_buffer,delimiters);
  Serial.print("The volume flow rate of water tank in LTR/MIN ------>\t");
  Serial.print(water_tank_flow_rate);
  Serial.println("");
  ask_ques_get_res(question_2);
  water_volume = get_the_data(data_buffer,delimiters);
  Serial.print("The Quantity of water released into Water Tank ------>\t");
  Serial.print(water_volume);
  Serial.println("");
  ask_ques_get_res(question_3);
  tank_a_flow_rate = get_the_data(data_buffer,delimiters);
  Serial.print("The volume flow rate of Metering pump Connected to the Tank A in LTR/MIN ------>\t");
  Serial.print(tank_a_flow_rate);
  Serial.println("");
  ask_ques_get_res(question_4);
  tank_a_volume = get_the_data(data_buffer,delimiters);
  Serial.print("The Quantity of Solution released into the Reaction Tank From TANK - A in LTR's ------>\t");
  Serial.print(tank_a_volume);
  Serial.println("");
  ask_ques_get_res(question_5);
  tank_b_flow_rate = get_the_data(data_buffer,delimiters);
  Serial.print("The volume flow rate of Metering pump Connected to the Tank B in LTR/MIN ------>\t");
  Serial.print(tank_b_flow_rate);
  Serial.println("");
  ask_ques_get_res(question_6);
  tank_b_volume = get_the_data(data_buffer,delimiters);
  Serial.print("The Quantity of Solution released into the Reaction Tank From TANK - B in LTR's ------>\t");
  Serial.print(tank_b_volume);
  Serial.println("");

}


void loop(){
  //---------       STEP 1            ------\\
  // relese_water() function is used to relesae the user specified water into water tank.
  // this function is defined later
  release_water();

}





void ask_ques_get_res(String question){
  Serial.println(question);
  while(!get_serial_string()){
    //wait here until data is received normally few micro seconds
    //it calls the function named get_serial_string and the function returns true if the full data received
  }
  Serial.print("you entered----->\t"); // print the user entered data
  Serial.println(data_buffer);
}


// it returns true if the data is fully received
boolean get_serial_string(){
  static byte data_buffer_index = 0;
  while(Serial.available()>0){// loop until serial Rx buffer is empty
    char incomingbyte = Serial.read();// read the data from serial buffer
    if(incomingbyte==starting_character){
      data_buffer_index = 0;  //Initialize our dataBufferIndex variable
      store_string = true; // we received the starting character so start reading   
    }
    if(store_string){
      //Let's check our index here, and abort if we're outside our buffer size
      //We use our define here so our buffer size can be easily modified
      if(data_buffer_index==data_buffer_size){
        //Oops, our index is pointing to an array element outside our buffer.
        Serial.println("Max characters in data buffer reached::::: the data_buffer_index_is reinitialized to 0");
        data_buffer_index = 0;
        break;
      }
      if(incomingbyte==ending_character){
        data_buffer[data_buffer_index] = 0; //null terminate the C string
        //Our data string is complete.  return true
        return true;
      }
      else{
        data_buffer[data_buffer_index++] = incomingbyte;
        data_buffer[data_buffer_index] = 0; //null terminate the C string
      }
    }
    else{
      Serial.println("Receiving Unwanetd Data.. Please check connections");
    }
  }//end of whiule loop

  //We've read in all the available Serial data, and don't have a valid string yet, so return false
  return false;
}


// function to Split spring and get the numeric data back
// using the strtok() function is a two step process
//the first call to strtok() initialization call. we pass it into the string (character array terminated with null)
//to be tokenized. and delimiters and it pases back the a pointer to the first token
//the second step is typically loop that repeatedly calls strtok().
// in this case we check if it is null or not.
// if its NULL,strtok finished tokenizing our string. if isn't NULL we make anothe call to strtok();
int get_the_data(char* buffer,const char* delimiter){
  char* val_position;
  int data;
  val_position = strtok(buffer,delimiter);
  while(val_position != NULL){
    data = atoi(val_position);
    val_position = strtok(NULL,delimiter);
  }
  return data;
}




void release_water(){
  s3_position = digitalRead(s3_pin);// check the s3 valve position 
  if (!s3_position){// if s3 valve is closed
    // calculate the time interval to open the valve
    unsigned long water_tank_time = water_tank_flow_rate * water_volume;//we get time in Min Convert it to milliSeconds Since the function millis returns milliseconds value
    water_tank_time = water_tank_time *60*1000;
    // declare the variable to hold the run time
    unsigned long water_tank_run_time;
    //open the s1 valve to release the water from water tank to tank A
    digitalWrite(s1_pin,HIGH);
    //Start the timer
    unsigned long water_tank_start_time = millis();
    while((water_tank_run_time = millis() - water_tank_start_time) >= water_tank_time)
    {
      // keep open the s1 valve until required amount is released in to Tank A
      Serial.print("The amount of water released into Tank A -------->\t");
      Serial.print(water_tank_run_time * water_tank_flow_rate);
    }//end of the while loop
    //the transfer is completed close the valve
    digitalWrite(s1_pin,LOW);
  }//end of if loop
  else{
    Serial.println("Please check the position of S3 Valve");
  }
}// end of release_water() function

i am getting the following error when I compile the code

error: 's1_pin' was not declared in this scope

But I declare the s1_pin
#define s1_pin 3

Why I am getting the error?

Lol.

//------------------------ PIN DECLARATION --------------------\\
#define s1_pin 3

Woe betide the programmer who makes really pretty comments.

thanks.

You just open your bag of tricks and pull out the right tool :grin:

You just open your bag of tricks and pull out the right tool

Easy to do when you've been at it long enough to have all the right tools.