         if(IR())
           delay(1000);
         else
-          delay((rand() / RAND_MAX) * light());       
+          delay(light() / 200.0 * 1500.0 + 500.0 + rand() / RAND_MAX * 250);       
     }
 
     for(int i = start; i < start+n_serial; ++i)

  Serial.print("Light: ");
  Serial.println(num);
  Serial.flush();
  return 100000 / num;
}

int irSensorPin = 2;

        if(IR())
          delay(1000);
        else
          delay(light() / 200.0 * 1500.0 + 500.0 + rand() / RAND_MAX * 250);
    }
            
}
