A Hamster wheel Projekt with hallsensor and timer

/*Hamsterrad Duechmesser 20cm Umfang 63cm */

const int hallPin = 4;          // 4 the number of the hall effect sensor pin
const int ledPin = 7;     // 7 the number of the LED pin
const int ledPin2 = 3; 
const int ledPin3 = 1;
// variables will change:

int hallState = 0;          // variable for reading the hall sensor status

void setup() { 
  // initialize the hall effect sensor pin as an input:
  pinMode(hallPin, INPUT);     
  // set the digital pin as output:
  pinMode(ledPin, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);

void loop(){

  // read the state of the hall effect sensor:
  hallState = digitalRead(hallPin);
// unsigned long currentMillis = millis();
   if (hallState == HIGH) {     
    // turn LED on:    
    digitalWrite(ledPin, HIGH);  
    digitalWrite(ledPin2, HIGH);
    digitalWrite(ledPin3, HIGH); 
    else {
     // turn LED off:
    digitalWrite(ledPin, LOW);
    digitalWrite(ledPin2, LOW); 
    digitalWrite(ledPin3, LOW); 

hi i have this code for a Hamster wheel.

i want turn off all leds when the Hallsensor after 5 minutes not conneced.

I don't understand the purpose of all the delays: what are you after? Do you just want a nice-looking pattern for your lights to turn on or do the delays have some technical purpose? Your code spends most of it's time delaying, and while it does, it can't begin the 5 minutes countdown you want. Also, you set a varable to millis(), but then you don't make any use of it.

When your sensor goes low, the program starts the procedure to turn the LEDs off, but only after the first group of 1 s delays is over.

Also, you set a varable to millis(), but then you don’t make any use of it.

Nah it’s remmed out:

// unsigned long currentMillis = millis();

Maybe OP was thinking about embarking on a delay-less approach?

I think your program is just not working. The chances of testing the hall as triggered are very small because you only take a quick look at the sensor and then stall for seconds in the led handling.

I would suggest looking for the hall changing from low to high and remembering that time.

The display of the leds should not use delays.

Nah it's remmed out:

// unsigned long currentMillis = millis();

Yeah, i can see that now. But even without a comment, this line wuold have no effect: I think this was what triggered my answer.

yes i want a nice blinking led when the wheel runs when the wheel not run i want turn off all leds when the wheel stops