help with this sketch:light sensor and blinking LED's

So I'm trying to make it so that when it gets dark these LED's turn on and blink in sequence for a bit then turn off. I've got the blinking down but cannot make it so that it only does it when it gets dark (and have no clue how to make it so that it turns off by itself...but I guess that's not really necessary, but would just be nice) I'm using an UNO and here's my code thus far:

int timer = 100;
int sensorPin = A0;
unsigned int sensorValue = 0;
int pinArray[] = {2,3,4};

void setup() {
// use a for loop to initialize each pin as an output:
Serial.begin(9600);
for (int thisPin = 2; thisPin < 8; thisPin++) {
pinMode(thisPin, OUTPUT);
}
}

void loop() {
sensorValue = analogRead(sensorPin);
if (sensorValue>190) digitalWrite(pinArray[2], LOW);
else for (int thisPin = 2; thisPin < 8; thisPin++)
{ digitalWrite(thisPin, HIGH);
delay(timer);
digitalWrite(thisPin, LOW); }

for (int thisPin = 7; thisPin >= 2; thisPin--)
{ digitalWrite(thisPin, HIGH);
delay(timer);
digitalWrite(thisPin, LOW); }
}

void loop() {
sensorValue = analogRead(sensorPin);
if (sensorValue>190) {
execute_dim_led();
} else {
execute_blink_led();
}

void execute_dim_led() {
your code to dim led here
}

void execute_blink_led() {
your code to blink led here
}

void loop() {
sensorValue = analogRead(sensorPin);
if (sensorValue>190) {
execute_dim_led();
} else {
execute_blink_led();
}
} // <=== You missed one

void execute_dim_led() {
your code to dim led here
}

void execute_blink_led() {
your code to blink led here
}

Of course, if you had put the { on a new line where it belongs, and properly indented the code, you'd have seen that.

PaulS:

void loop() {
sensorValue = analogRead(sensorPin);
if (sensorValue>190) {
execute_dim_led();
} else {
execute_blink_led();
}
} // <=== You missed one

void execute_dim_led() {
your code to dim led here
}

void execute_blink_led() {
your code to blink led here
}

Of course, if you had put the { on a new line where it belongs, and properly indented the code, you'd have seen that.

Thx for pointing it.

thanks all, this really helped!!! XD