Hello cisco87,
you can simply trigger the sequence by reading the photoresistor:
void loop()
{
int lightLevel = analogRead(lightPin);
// ...
if( lightLevel < lowThreshold )
{
inAndOut();
}
else
{
// ...
}
}
consider that the analog channel is read when the "inAndOut" function completes its execution, once evey 6*100 = 600 millisec.