   if (DEBUG_PRINT) {
     Serial.println("IRSend PIR input change called");
   }
-  // need to update, remove delay, use timer. 
+  // need to update, remove delay, use timer.
   if ( wrkModeStatus == 1 && o_startMode == 1 && tvPowerStatus == 1) {
     switch (a) {
       case 0:
         irsend.sendNEC(tv_input, 32);
-        delay(3000);
-        for ( int i = 0 ; i < o_channelGap ; i++ ) {
-          irsend.sendNEC(tv_left, 32);
-          delay(100);
-        }
-        irsend.sendNEC(tv_enter, 32);
+        irSendTvOutToCurChEvent = t.after(channelselectiondelay, irSendTvOutToCurCh);
         break;
       case 1:
         irsend.sendNEC(tv_input, 32);
-        delay(3000);
-        for ( int i = 0 ; i < o_channelGap ; i++ ) {
-          irsend.sendNEC(tv_right, 32);
-          delay(100);
-        }
-        irsend.sendNEC(tv_enter, 32);
+        irSendTvOutToBlnkChEvent = t.after(channelselectiondelay, irSendTvOutToBlnkCh);
         break;
     }
 


// Timer status
int timerStatus = 0;

// tv IR code
unsigned long tv_input = 0x20DFD02F;

Timer t;
long temp_Mills;
long pir_Mills;

int tvIsOnEvent;

int irSendTvOutToCurChEvent ; 
int irSendTvOutToBlnkChEvent ;



// eeprom status
int o_pwrSrc;
