Stop and Go

Alright here is the code that we have so far. Any help would be greatly appreciated.

// Reports the frequency from the TSL230, higher number means brighter
// Part: http://www.sparkfun.com/products/8940
// Article:  http://bildr.org/2011/08/tsl230r-arduino/ 

#include <Servo.h>
Servo myservo1;
int TSL230_Pin = 4; //TSL230 output
int TSL230_s0 = 3; //TSL230 sensitivity setting 1
int TSL230_s1 = 2; //TSL230 sensitivity setting 2

int TSL230_samples = 30; //higher = slower but more stable and accurate
boolean once;
void setup(){
  Serial.begin(9600);
  setupTSL230();
  pinMode(5,OUTPUT);
  myservo1.attach(5);
  



}


void loop(){

  float lightLevel = readTSL230(TSL230_samples);
  Serial.println(lightLevel);
boolean once;
if(lightLevel>1800 && lightLevel<10000 && once == true)
  {
   
    myservo1.writeMicroseconds(1300);delay(5000);
    myservo1.writeMicroseconds(1500);delay(5000);  
    once = false;
}

else if(lightLevel<1800 && once == false)
{
  myservo1.attach(5);
  myservo1.writeMicroseconds(1700);delay(5000);
  myservo1.writeMicroseconds(1500);delay(5000);
  once = true;
}
}

void setupTSL230(){
  pinMode(TSL230_s0, OUTPUT); 
  pinMode(TSL230_s1, OUTPUT); 

  //configure sensitivity - Can set to
  //S1 LOW  | S0 HIGH: low
  //S1 HIGH | S0 LOW:  med
  //S1 HIGH | S0 HIGH: high

  digitalWrite(TSL230_s1, LOW);
  digitalWrite(TSL230_s0, HIGH);
}



float readTSL230(int samples){
//sample light, return reading in frequency
//higher number means brighter

  float start = micros();  
  int readings = 0;

  while(readings < samples){
   pulseIn(TSL230_Pin, HIGH);
   readings ++;
  }

  float length = micros() - start;
  float freq = (1000000 / (length / samples)) * 10;

  return freq;
}