AUTOMATIC CHASER WITH SPEED CONTROL

MICROCONTROLLER -- MSP430G2553

int b;
void setup() {              

  pinMode(P1_6, OUTPUT);
 pinMode(P1_7, OUTPUT);

}

void loop() {
 b=10000/(analogRead(A3)+1);
 for(int a=0;a<b;a++)
 {
  b=10000/(analogRead(A3)+1);
  digitalWrite(P1_6, HIGH);     digitalWrite(P1_7, LOW);
  delay(b);                
  digitalWrite(P1_6, LOW);  digitalWrite(P1_7, HIGH);    
  delay(b);  
 }
  b=10000/(analogRead(A3)+1);
   for(int a=0;a<b;a++)
 {
  b=10000/(analogRead(A3)+1);
  digitalWrite(P1_6, HIGH);     digitalWrite(P1_7, HIGH);
  delay(b);              
  digitalWrite(P1_6, LOW);  digitalWrite(P1_7,LOW);    
  delay(b);  
 }
   digitalWrite(P1_6, LOW);  digitalWrite(P1_7, LOW);
     delay(2000);

}