Code not working?

Hello!
Recently, one of my fathers factory machines broke. He asked me to fix it, and I did. I used an arduino uno, with a 4 module relay and a A10K potentiometer. I wrote the code, but for some reason, it does not work, nothing at all. The verifier in the program works fine, and found no problems in the code.
Any clues?
(PS. Do note, i included those notes in the code to explain to my father what everything did, as he is interested in learning arduino for himself. )

#define Pincers 13  //Defines all the pins, and what they are named
#define armHydraulic 12
#define overheadHydraulic 11
#define airValve 10
#define potentiometer 1
#define button 2
#define emergency 3

int val = 0;

void setup() {

  pinMode(Pincers, OUTPUT); //Defines wether the pin is input or output
  pinMode(armHydraulic, OUTPUT);  
  pinMode(overheadHydraulic, OUTPUT);
  pinMode(airValve, OUTPUT);
  pinMode(potentiometer, INPUT);
  pinMode(button, INPUT);
  pinMode(emergency, INPUT);

}

void loop() {

  if(button == HIGH){
    delay(2000); //delay 2 sec
    digitalWrite(Pincers, HIGH); //Turns on the pincers
    delay(2000); //delay 2 sec
    digitalWrite(armHydraulic, HIGH); //Pushes the 1st hydraulic arm forward
    delay(3000); //delay 3 sec
    digitalWrite(overheadHydraulic, HIGH); //Pushes the top hydraulic arm down
    delay(3000); //delay 3 sec
    val = analogRead(potentiometer) * 10; //The value is equal to what the potentiometer is reading 
    digitalWrite(airValve, HIGH); // The air valve is opened
    delay(val); // the delay is equal to val

    digitalWrite(airValve, LOW); // The proecess above in reverse
    delay(2000);
    digitalWrite(overheadHydraulic, LOW);
    delay(2000);
    digitalWrite(armHydraulic, LOW);
    delay(2000);
    digitalWrite(Pincers, LOW);
    delay(1000);
  }
    else{

    digitalWrite(airValve, LOW); 
    digitalWrite(overheadHydraulic, LOW);
    digitalWrite(armHydraulic, LOW);
    digitalWrite(Pincers, LOW);
    
  }

    if(emergency == HIGH);{

    digitalWrite(airValve, LOW); // This turns off all the processes, if the emergency button is pressed
    delay(2000);
    digitalWrite(overheadHydraulic, LOW);
    delay(2000);
    digitalWrite(armHydraulic, LOW);
    delay(2000);
    digitalWrite(Pincers, LOW);
    delay(1000);
    }
}

This is a common mistake:

  if(button == HIGH){

You are comparing the pin number to HIGH. You need to use digitalRead to get the state of the pin.

Same thing here, with another classic issue on top:

   if(emergency == HIGH);{

That semicolon defeats the if - get rid of it.

thank you very much :slight_smile:
if you dont mind, would you give an example on how to use digitalRead?

File/Examples/02.Digital/Button in the IDE

clockpie_5436:
The verifier in the program works fine, and found no problems in the code.

Yes, well the verifier finds syntactic problems, not semantic ones. For example this is OK in English:

A dog is a cat.

Perfectly valid English, however it is nonsense.

How about:

The purple dreams move softly to the green exit.

That's OK syntactically, however it doesn't mean anything.

UKHeliBob:
File/Examples/02.Digital/Button in the IDE

thank you very much

if(emergency == HIGH); This is also a very common semantic error, and almost certainly NOT what you intended.
It's also a good demonstration why an emergency stop should not be handled in software, and why you should never use delay()