 
     
   Serial.println("");
-  delay(20);    
+
 }
 
 

int irBase=20;
int irMax=230;

int t1=0;
int t2=0;

int state= 0; // 0= off, 1 = on


int pwmOut=9;




void switchState(){
  if(state == 0){
    state = 1;
  }else{
    state = 0;
  }
  
}



void loop() { 


  unsigned long thisTime= millis();
  
  if( thisTime >= lastTime + timeDelta){
    Serial.print(thisTime);
    Serial.println("BINGO");
    
    lastTime=thisTime;
    
  }
  
  readIR();


  if( irSensorVal >= (t1 + irDelta) ){
    switchState();
  }

  if(irSensorVal <  (t1 + irDelta) ){
     readyForChange=1; 
  }


  
  if(state == 1){
    analogWrite(pwmOut,200);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255  
