user55563: I am new to Arduino, some how I have put this code together to run stepper motor using LDR(kind of solar tracker program) I searched on net and tried using servo motor circuit to run stepper motor, assuming just replacing servo motor with stepper motor would work. I guess that is not the case (because servo motor is not moving according to LRD inputs). Please help me with circuit diagram. 
Here is the code I am using 

const int dirPin  = 5;
const int stepPin = 4;
const int enPin   = 6;
const int SensorPin1 = A0;
const int SensorPin2 = A1;
int sensorValue1 = 0;
int sensorValue2 = 0;

void setup() {

  pinMode(stepPin,OUTPUT);
  pinMode(dirPin,OUTPUT);

  pinMode(enPin,OUTPUT);
  digitalWrite(enPin,LOW);
  Serial.begin(9600); 

}
void loop() {
  sensorValue1 = analogRead(SensorPin1); 
  Serial.println(sensorValue1);
  sensorValue2 = analogRead(SensorPin2); 
  Serial.println(sensorValue2);

  if(sensorValue1 < 40 && sensorValue2 < 400){
    Serial.print("No sun Detected");
    digitalWrite(dirPin,LOW);
    digitalWrite(stepPin,LOW);
  }
  else if(sensorValue1 > 400){

    digitalWrite(dirPin,HIGH);
    digitalWrite(stepPin,HIGH);

 }
else if(sensorValue2 > 400){
    digitalWrite(dirPin,LOW);
    digitalWrite(stepPin,HIGH);
}
}


Hardware Used:

Bipolar stepper motor- NEMA 23 20Kg torque  
Stepper driver: TB6600
Power supply: SMPS 12V, 5amp 
LDR: 2 
Resistors: 2, 10K resistors 
1 Arduino Uno
Breadboard 



user63023: If it helps, I tuned your code little.
const int dirPin  = 8;
const int stepPin = 7;
const int enPin   = 13;//with pin 13 You can monitor on-board LED, if its lit, "enable" is HIGH and stepper will turn.
const int rightSensorPin = A0;
const int leftSensorPin = A1;
int rightSensorRead = 0;
int leftSensorRead = 0;
int rightLightPct = 0;
int leftLightPct = 0;
int degreeChange = 1;


void setup() {
  Serial.begin(9600);
  pinMode(stepPin,OUTPUT);
  pinMode(dirPin,OUTPUT);
  pinMode(enPin,OUTPUT);
  pinMode(A0, INPUT_PULLUP);//no need extra resistors. Just connect one LDR leg to A0 and another GND.
  pinMode(A1, INPUT_PULLUP);
}

void loop() {
  rightSensorRead = analogRead(rightSensorPin);
  leftSensorRead = analogRead(leftSensorPin);
  rightLightPct = map(rightSensorRead, 0, 1023, 0, 100);
  leftLightPct = map(leftSensorRead, 0, 1023, 0, 100);
  degreeChange = map(abs(rightLightPct-leftLightPct),0,100,2,10);
  Serial.print("right = ");
  Serial.print(rightSensorRead);
  Serial.print(" left = ");
  Serial.print(leftSensorRead);
  Serial.print(" Pct r/l = ");
  Serial.print(rightLightPct);
  Serial.print("/");
  Serial.println(leftLightPct);
  if(rightLightPct < 15 && leftLightPct < 15){
    Serial.println("Sun is detected");
    digitalWrite(enPin, LOW);
    digitalWrite(dirPin,LOW);
    digitalWrite(stepPin,LOW);
    delay(5000);//if somthing get in a way, program waits 5 sec. If nothing in that time, program will continue. That time may erase or add some more.
  }else if(rightLightPct > 50 && leftLightPct > 50){
    Serial.println("Sun is set!");
    digitalWrite(enPin, LOW);
    digitalWrite(dirPin,LOW);
    digitalWrite(stepPin,LOW);
  }else if(rightLightPct > 20 && leftLightPct > 20){
    Serial.println("Seeking sun!");
    digitalWrite(enPin, HIGH);
    digitalWrite(dirPin,LOW);
    digitalWrite(stepPin,LOW);
    delay(1);
    digitalWrite(stepPin,HIGH);
  }else if(rightLightPct > leftLightPct){
    Serial.println("Turning CW!");
    digitalWrite(enPin, HIGH);
    digitalWrite(dirPin,HIGH);
    digitalWrite(stepPin,LOW);
    delay(1);
    digitalWrite(stepPin,HIGH);
  }else{
    Serial.println("Turning CCW!");
    digitalWrite(enPin, HIGH);
    digitalWrite(dirPin,LOW);
    digitalWrite(stepPin,LOW);
    delay(1);
    digitalWrite(stepPin,HIGH);
  }
}


55563: <p>I am new to Arduino, some how I have put this code together to run stepper motor using LDR(kind of solar tracker program) I searched on net and tried using servo motor circuit to run stepper motor, assuming just replacing servo motor with stepper motor would work. I guess that is not the case (because servo motor is not moving according to LRD inputs). Please help me with circuit diagram. </p>

<p>Here is the code I am using </p>

<pre><code>
const int dirPin  = 5;
const int stepPin = 4;
const int enPin   = 6;
const int SensorPin1 = A0;
const int SensorPin2 = A1;
int sensorValue1 = 0;
int sensorValue2 = 0;

void setup() {

  pinMode(stepPin,OUTPUT);
  pinMode(dirPin,OUTPUT);

  pinMode(enPin,OUTPUT);
  digitalWrite(enPin,LOW);
  Serial.begin(9600); 

}
void loop() {
  sensorValue1 = analogRead(SensorPin1); 
  Serial.println(sensorValue1);
  sensorValue2 = analogRead(SensorPin2); 
  Serial.println(sensorValue2);

  if(sensorValue1 &lt; 40 &amp;&amp; sensorValue2 &lt; 400){
    Serial.print("No sun Detected");
    digitalWrite(dirPin,LOW);
    digitalWrite(stepPin,LOW);
  }
  else if(sensorValue1 &gt; 400){

    digitalWrite(dirPin,HIGH);
    digitalWrite(stepPin,HIGH);

 }
else if(sensorValue2 &gt; 400){
    digitalWrite(dirPin,LOW);
    digitalWrite(stepPin,HIGH);
}
}

</code></pre>

<p><strong>Hardware Used:</strong></p>

<ul>
<li>Bipolar stepper motor- NEMA 23 20Kg torque  </li>
<li>Stepper driver: TB6600</li>
<li>Power supply: SMPS 12V, 5amp </li>
<li>LDR: 2 </li>
<li>Resistors: 2, 10K resistors </li>
<li>1 Arduino Uno</li>
<li>Breadboard </li>
</ul>

<p><a href="https://i.stack.imgur.com/Q3C1p.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Q3C1p.png" alt="Circuit Diagram"></a></p>
 63023: <p>If it helps, I tuned your code little.</p>

<pre><code>const int dirPin  = 8;
const int stepPin = 7;
const int enPin   = 13;//with pin 13 You can monitor on-board LED, if its lit, "enable" is HIGH and stepper will turn.
const int rightSensorPin = A0;
const int leftSensorPin = A1;
int rightSensorRead = 0;
int leftSensorRead = 0;
int rightLightPct = 0;
int leftLightPct = 0;
int degreeChange = 1;


void setup() {
  Serial.begin(9600);
  pinMode(stepPin,OUTPUT);
  pinMode(dirPin,OUTPUT);
  pinMode(enPin,OUTPUT);
  pinMode(A0, INPUT_PULLUP);//no need extra resistors. Just connect one LDR leg to A0 and another GND.
  pinMode(A1, INPUT_PULLUP);
}

void loop() {
  rightSensorRead = analogRead(rightSensorPin);
  leftSensorRead = analogRead(leftSensorPin);
  rightLightPct = map(rightSensorRead, 0, 1023, 0, 100);
  leftLightPct = map(leftSensorRead, 0, 1023, 0, 100);
  degreeChange = map(abs(rightLightPct-leftLightPct),0,100,2,10);
  Serial.print("right = ");
  Serial.print(rightSensorRead);
  Serial.print(" left = ");
  Serial.print(leftSensorRead);
  Serial.print(" Pct r/l = ");
  Serial.print(rightLightPct);
  Serial.print("/");
  Serial.println(leftLightPct);
  if(rightLightPct &lt; 15 &amp;&amp; leftLightPct &lt; 15){
    Serial.println("Sun is detected");
    digitalWrite(enPin, LOW);
    digitalWrite(dirPin,LOW);
    digitalWrite(stepPin,LOW);
    delay(5000);//if somthing get in a way, program waits 5 sec. If nothing in that time, program will continue. That time may erase or add some more.
  }else if(rightLightPct &gt; 50 &amp;&amp; leftLightPct &gt; 50){
    Serial.println("Sun is set!");
    digitalWrite(enPin, LOW);
    digitalWrite(dirPin,LOW);
    digitalWrite(stepPin,LOW);
  }else if(rightLightPct &gt; 20 &amp;&amp; leftLightPct &gt; 20){
    Serial.println("Seeking sun!");
    digitalWrite(enPin, HIGH);
    digitalWrite(dirPin,LOW);
    digitalWrite(stepPin,LOW);
    delay(1);
    digitalWrite(stepPin,HIGH);
  }else if(rightLightPct &gt; leftLightPct){
    Serial.println("Turning CW!");
    digitalWrite(enPin, HIGH);
    digitalWrite(dirPin,HIGH);
    digitalWrite(stepPin,LOW);
    delay(1);
    digitalWrite(stepPin,HIGH);
  }else{
    Serial.println("Turning CCW!");
    digitalWrite(enPin, HIGH);
    digitalWrite(dirPin,LOW);
    digitalWrite(stepPin,LOW);
    delay(1);
    digitalWrite(stepPin,HIGH);
  }
}
</code></pre>
