   if(dimVal > maxDim){
     dimVal = maxDim;
   }
-  
+  updataDimTimeValues(dimVal);
 }
 
   
   if(state == 1){
     analogWrite(pwmOut,dimVal);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255  
   }else if(state == 0){
-    analogWrite(pwmOut,0);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255  
-
+    analogWrite(pwmOut,0);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255   
   }
 
 
-   Serial.print("STATE: ");
-   Serial.print(state);
+  // Serial.print("STATE: ");
+  // Serial.print(state);
    
-   Serial.print("   HAND: ");
-   Serial.print(handposition);
+ //  Serial.print("   HAND: ");
+ //  Serial.print(handposition);
 
 
-  Serial.print("   IR Val:"); 
+ // Serial.print("   IR Val:"); 
 
-  Serial.print(irSensorVal);
+ // Serial.print(irSensorVal);
 
-   Serial.print("   DIMVAL: ");
-   Serial.print(dimVal);
-    
-  Serial.println("");
+  // Serial.print("   DIMVAL: ");
+  // Serial.print(dimVal);
+
+
+
+
+
+  
+  //Serial.println("");
+
+  delay(40);
 
 }
 

int dimVal=200;
int readyForChange=1;


int pwmOut=9;

unsigned long lastTime;
int timeDelta=500;


void switchState(){

    }
      handposition=0;
      dimMode=0;
      dimVal=dimTimeValues[(dimTimeValuesAmount-1)];
  }


