     newPosition = myEnc.read();
     if ((newPosition != oldPosition) )
     {
-      if (newPosition < VALMIN * 4)
-        {
-          myEnc.write(VALMIN * 4);
+      if (newPosition < VALMIN * ENCODERSTEPS)
+        {
+          myEnc.write(VALMIN * ENCODERSTEPS);
           newPosition = 0;
         }
-        else if (newPosition > VALMAX * 4)
-        {
-          myEnc.write(VALMAX * 4);
+        else if (newPosition > VALMAX * ENCODERSTEPS)
+        {
+          myEnc.write(VALMAX * ENCODERSTEPS);
           newPosition = 40; 
         }
         else

          lcd.clear();
          lcd.print("New balance :");
          lcd.setCursor(0,1);
          lcd.print(newPosition / 4);
          
          oldPosition = newPosition;
          Serial.println(newPosition / 4);  
         } 
    }
  }
  myEnc.write(0);
  oldPosition = -1;
  return (newPosition / 4);
}

void nfc_write()


#define MENUELEMENTS 4 //number of elements in the menu

#define ENCODERSTEPS 2
#define VALMIN 0 //min value of the new balance in the write sequence.
#define VALMAX 99999 //maw value of the new balance in the write sequence 

