Could anybody help me solve this project? Thanks.

Hi,all:

I use the switch case to control LED ,in case 1,
I want to control the interval value {i=0 ,interval[0]=1000,i=1,interval[1]=3000}
How can I change the i value every 10 sec?
Could anybody help me? Thanks.

#include <IRremote.h>
int PIRSensor = 2; 
int sensorValue_old = -1;
const int ledPin =  13;
int ledState = LOW;
unsigned long previousTime=0;
unsigned long currentTime=0;
int interval[2]={1000,3000};
int i=0;
IRsend irsend; 
void setup() {
    Serial.begin(9600);
    pinMode(ledPin, OUTPUT);   
}
void loop() {
  int sensorValue = digitalRead(PIRSensor);
  Serial.println(sensorValue);
  switch(sensorValue){
  case 0:
  digitalWrite(13, HIGH);
  if(sensorValue != sensorValue_old){
  sensorValue_old = sensorValue;
  irsend.sendNEC(0xCE01F, 32);
  }
  break;
  case 1:
 unsigned long currentTime = millis();
 if(currentTime - previousTime > interval[i]) {
    if (ledState == LOW)
      ledState = HIGH;
    else
      ledState = LOW;
    previousTime= currentTime;
    digitalWrite(ledPin, ledState);  
  }
  }
   if(sensorValue != sensorValue_old){
  sensorValue_old = sensorValue;
   irsend.sendNEC(0xCC03F, 32);
   }
  }

The demo Several Things at a Time illustrates the use of millis() to manage timing.

...R