writing a program that follows a specific oder of execution

Can any one offer any positive feedback and/or advice that will allow the code i have below to run and complete each section before moving to the next?

Thank you
Dave Pina

const int conv1 = 47;      // output pin the conveyor relay is attached to
const int turnhead = 48;   // output pin the turnhead relay is attached to

const int aggHopperGate1 = 49;      // output pin the gate1 relay is attached to
const int aggHopperGate2 = 50;      // output pin the gate2 relay is attached to
const int aggHopperGate3 = 51;      // output pin the gate3 relay is attached to

const int bindicatorlow1 = 25;          // input pin for the bin1 low signal
int bindicatorlowstatus1; 
const int bindicatorlow2 = 26;          // input pin for the bin2 low signal
int bindicatorlowstatus2;
const int bindicatorlow3 = 27;          // input pin for the bin3 low signal
int bindicatorlowstatus3;

// Variables will change:
int bindicatorlow1_State;         // current state of the aggstoragebindicator1
int last_bindicatorlow1_State;     // previous state of the aggstoragebindicator1

const int turnheadBin1 = 28;      // input pin for turnhead position1
int turnheadposition1;     
const int turnheadBin2 = 29;      // input pin for turnhead position2
int turnheadposition2; 
const int turnheadBin3 = 30;      // input pin for turnhead position3
int turnheadposition3;

// Variables will change:
int turnheadposition1_State;
int turnheadposition2_State;
int turnheadposition3_State;


void setup () 

{

  Serial.begin(9600);

  // sets all digital pins to OUTPUT state for conv1 and turnhead
  pinMode(conv1,   OUTPUT);
  pinMode(turnhead, OUTPUT);
  // sets all digital pins to OUTPUT state for each hopper gate
  pinMode(aggHopperGate1,  OUTPUT);
  pinMode(aggHopperGate2,  OUTPUT);
  pinMode(aggHopperGate3,  OUTPUT);

  // sets all digital pins to INPUT state for each bin low INPUT 
  pinMode(bindicatorlow1, INPUT);  
  pinMode(bindicatorlow2, INPUT);
  pinMode(bindicatorlow3, INPUT);
  // Set all binlow input bins to HIGH state    
  digitalWrite(25, HIGH);
  digitalWrite(26, HIGH);
  digitalWrite(27, HIGH);

  // sets all digital pins to INPUT state for each turnhead position
  pinMode(turnheadBin1, INPUT); 
  pinMode(turnheadBin2, INPUT);
  pinMode(turnheadBin3, INPUT);
  // Set all trunhead input bins to HIGH state 
  digitalWrite(28, HIGH);
  digitalWrite(29, HIGH);
  digitalWrite(30, HIGH);

}


void loop()
{
  bindicatorlowstatus1 = digitalRead(bindicatorlow1); 
  bindicatorlowstatus2 = digitalRead(bindicatorlow2); 
  bindicatorlowstatus3 = digitalRead(bindicatorlow3);
  
  
//################################################## RUN SECETION 1 ###########################################################

        if  (( bindicatorlowstatus1 == LOW) || (bindicatorlowstatus2 == LOW) || (bindicatorlowstatus3 == LOW)){
          digitalWrite(conv1, LOW); //start conveyor 1     
          delay(2000);
          Serial.write("conveyor 1 has started");
      
              if (bindicatorlowstatus1 == LOW){ //if its bindicator 1 thats LOW meaning the material has dropped we fill the plant
                digitalWrite(turnhead, LOW); //start turnhead
                turnheadposition1_State = digitalRead(turnheadBin1); //read current state of turnhead position for bin 1
                 
                if (turnheadposition1_State = LOW){ //if turnhead has reached bin 1 position STOP turnhead
                digitalWrite(turnhead, HIGH); //stop turnhead
        
                delay(4000); //wait 4 seconds
                digitalWrite(aggHopperGate1, LOW); //open aggHopperGate1
                
                    if(bindicatorlowstatus1 == HIGH);{//bin has reached full close gate
                    digitalWrite(aggHopperGate1, HIGH);//close aggHopperGate1 
                    }
                 }
              }
              
//##################################### WAIT TILL SECTION 1 IS COMPLETE THEN RUN SECETION 2 ############################################ 

              if (bindicatorlowstatus2 == LOW){ //if its bindicator 1 thats LOW meaning the material has dropped we fill the plant
                digitalWrite(turnhead, LOW); //start turnhead
                turnheadposition2_State = digitalRead(turnheadBin2); //read current state of turnhead position for bin 1
                 
                if (turnheadposition2_State = LOW){ //if turnhead has reached bin 1 position
                digitalWrite(turnhead, HIGH); //stop turnhead
        
                delay(4000); //wait 4 seconds
                digitalWrite(aggHopperGate2, LOW); //open aggHopperGate1
                
                    if(bindicatorlowstatus2 == HIGH);{//bin has reached full limit close gate
                    digitalWrite(aggHopperGate2, HIGH);//close aggHopperGate1 
                    }
                 }
              }
              
//######################################## WAIT TILL SECTION 2 IS COMPLETE THEN RUN SECETION 3 ########################################### 

              if (bindicatorlowstatus3 == LOW){ //if its bindicator 1 thats LOW meaning the material has dropped we fill the plant
                digitalWrite(turnhead, LOW); //start turnhead
                turnheadposition3_State = digitalRead(turnheadBin3); //read current state of turnhead position for bin 1
                
                if (turnheadposition3_State = LOW){ //if turnhead has reached bin 1 position
                digitalWrite(turnhead, HIGH); //stop turnhead
        
                delay(4000); //wait 4 seconds
                digitalWrite(aggHopperGate3, LOW); //open aggHopperGate1
                
                    if(bindicatorlowstatus3 == HIGH);{//bin has reached full limit close gate
                    digitalWrite(aggHopperGate3, HIGH);//close aggHopperGate1 
                    }
                 }
              }                 
        }
}

//################################################REPEAT SECTION 1, 2, 3 ###########################################################

I started to read
your code, but it
wandered across
the page and
I got tired of chasing it...

What input is there to indicate that a particular section has finished ?

Consider the use of while instead of if in your sections and test input(s) until there is an indication that a section has completed

if(bindicatorlowstatus1 == HIGH);{//bin has reached full close gate

The semicolon should not be there. You have other instances of this in your code too. Fix them all, tidy your code using the IDE menu Tools|Auto Format, and then try running it again.

Pete

PaulS:
I started to read
your code, but it
wandered across
the page and
I got tired of chasing it...

Well its clear you did not read my post, I also read your input and feedback but also appears to be a waste of my time chasing it as well. This is a forum for which all walks of life come to learn, ask questions, share and provide experience and knowledge to those who are not as experienced. So please, if you can not offer positive and/or constructive advice that will help those that are willing to use this forum for its purpose, then please DO NOT OFFER ANY INPUT.

Thank you
Dave Pina

UKHeliBob:
What input is there to indicate that a particular section has finished ?

Consider the use of while instead of if in your sections and test input(s) until there is an indication that a section has completed

Excellent!! thank you, I'll give that a try!

Thank you
Dave Pina

el_supremo:

if(bindicatorlowstatus1 == HIGH);{//bin has reached full close gate

The semicolon should not be there. You have other instances of this in your code too. Fix them all, tidy your code using the IDE menu Tools|Auto Format, and then try running it again.

Pete

Excellent!! thank you, I'll give that a try!

Thank you
Dave Pina

  // Set all trunhead input bins to HIGH state 
  digitalWrite(28, HIGH);
  digitalWrite(29, HIGH);
  digitalWrite(30, HIGH);

You go to the trouble of giving the pins nice names, then don't use them.
Why?

The comment is inaccurate - the digitalWrite enables the internal pull ups.

I also agree that the application of the auto format tool would be beneficial.

concretefreak:
I also read your input and feedback but also appears to be a waste of my time chasing it as well.

You're asking for help which requires us to read and understand your code. You code is laid out in such a way that it makes this task unnecessarily difficult. Help us to help you by adopting a layout that makes your code easy to read. If you put each { and } on separate lines and use the Tools/Auto Format option this is easy to do and will greatly increase the chance that we can be bothered to read through your code.