 unsigned long currentMillis;
 
 int charToInt(char c){
-  return (char)c;
+  int i = (int) c;
+  if(i < 48 || 58 < i){
+    return -1;
+  }
+  return (i - 48) * 6;
 }
 
 void decLevel(){

    previousMillis += INTERVAL;
    updateActualLevel();
    rainbow();
    Serial.println(mLevel);
  }
}


void loop(){
  while(Serial.available() > 0) {
    int level = charToInt(Serial.read());
    if(level < 0){
      continue;
    }
    setLevel(level);
  }

