Why dont work? 8 relay board

i write shis code for controll single relay... but the 3 -4 -5 raly stay on... fix?

// constants won't change. They're used here to set pin numbers:
const int radio = 2;     // the number of the pushbutton pin
const int rele1 =  3;      //alimentaxione motore 1 open
const int rele2 =  4;      //alimentaxione motore 2 open
const int rele3 =  5;      // close anta 1
const int rele4 =  6;      // the number of the LED pin


// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(rele1, OUTPUT);
  pinMode(rele2, OUTPUT);
  pinMode(rele3, OUTPUT);
  pinMode(rele4, OUTPUT);
  pinMode(radio, INPUT_PULLUP);
  
  }

void loop() {
  // read the state of the pushbutton value:
  buttonState = digitalRead(radio);

  // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
  if (buttonState == HIGH) {
    // turn LED on:
    digitalWrite(rele1, HIGH);
    delay(10000);    // TEMPO APèETURA DA MODIFIOCARE
    digitalWrite(rele1, LOW);
    delay(20000);   // tempo ingresso
    digitalWrite(rele4, HIGH);
    delay(1000);   // pausetta
    digitalWrite(rele2, HIGH);
    digitalWrite(rele3, HIGH);
    delay(1000);   // pausetta
    digitalWrite(rele1, HIGH); 
    delay(10000);    // TEMPO CHIUSURA DA MODIFIOCARE
    //DISATTIVA TUTTO
    digitalWrite(rele2, LOW);
    digitalWrite(rele3, LOW);
    digitalWrite(rele4, LOW);
    delay(1000);   // anti spam
  } else {
    // turn LED off:
    digitalWrite(rele1, HIGH);
    digitalWrite(rele2, HIGH);
    digitalWrite(rele3, HIGH);
    digitalWrite(rele4, HIGH);
  }
}`Testo preformattato`

Read the forum guidelines to see how to properly post code and some information on how to get the most from this forum.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

You can go back and fix your original post by highlighting the code and clicking the </> in the menu bar.
code tags new

What relays? Post a photo or link to where you bought them.

How are they wired? Post a schematic.

Is it a relay module that has active LOW inputs (relays turn on with a LOW signal)?

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