     sequence[i] = redButton;
   }
   
-  stateRedButton = 0;
-  
+  for (int i = 0; i < 4; i++ ) {
+    buttonStates[i] = buttonUnknow;
+  }
+  
+  buttonFeedBackStartMillis = 0;
 }
 
 void loop() {
-  
-    computeButtonStates(0, redButton, redLed);  
-    computeButtonStates(1, greenButton, greenLed);  
-    computeButtonStates(2, yellowButton, yello);  
-    computeButtonStates(3, blueButton);  
-  
+ 
   if (state == stateNewLevel) {
     level ++;
-    String a = "livello ";
-     a += level;
-    displayWrite(a);
+    displayStringInt("livello ", level);
     delay(2000);
     state = statePrepare;
   }
   
-  if (state == stateEnd) {
-    String a = "punti ";
-    a += level;
-    displayWrite(a);
-  }
-
   if (state == statePrepare) {
     //set
     for (int i = level - 1 ; i < level; i++) {

        mapLevel = maxMapLevel;
      }
      int delayMemorization = 500 + map(mapLevel, 1, maxMapLevel, 800, 0);
      
      //Serial.println(delayMemorization);
      
      delay(delayMemorization);
      noTone(tonePin);
      allLedOff();

      if (button == 2) sequence[i] = yellowButton;
      if (button == 3) sequence[i] = blueButton;
    }
    
    //play
    displayString("memorizza");
    for (int i = 0; i < level; i++) {
      int button = sequence[i];
      if (button == redButton) { tone(tonePin, NOTE_C4); digitalWrite(redLed, HIGH); } 
