i dont understand why my script is not working

im trying to rotate a stepper motor when night brakes in and rotate it in the other direction when day brakes in but i dont understand why it dose not stop after rotatign 1 time in the 1 direction.

please help

#include <Stepper.h>
#define Lightsensor A5
const int off = 100;
const int led = 7;
int openclosed;

Stepper myStepper(1000, 8, 10, 9, 11);


void setup() {

  Serial.begin(9600);

  myStepper.setSpeed(15);

  pinMode (led, OUTPUT);

  digitalWrite (openclosed, 1);
}

void loop() {
  // put your main code here, to run repeatedly:




  int Lightlevel = analogRead(Lightsensor);
  Serial.println(Lightlevel);
  delay(10);




  if (Lightlevel > off) {

    if (openclosed == HIGH) {
      digitalWrite(led, 0);
      myStepper.step(1200);
      digitalWrite (openclosed, 1);

    }
  }
  else if (Lightlevel < off)
  {
    if (openclosed == 0) {
      digitalWrite(led, HIGH);
      myStepper.step(-1200);
      digitalWrite (openclosed, 1);

    }
  }




  delay(1000);
}

thanks for helping

Your code say you want to move the stepper in one direction for as long as it's daytime and in the other direction for as long as it's nightime.

You need to check when the light level BECOMES higher than threshold or BECOMES lower than threshold...not just when it IS high or low. Have a look at the StateChangeDetection example in the IDE and see if that gives you any ideas.

Steve