setting threshold via buttons ?

how to set microphone threshold using buttons? thanks

this is my code but not working ! :(

void loop()
{
   byte button;
   val = 400;
   //get the latest button pressed, also the buttonJustPressed, buttonJustReleased flags
   button = ReadButtons();
   //blank the demo text line if a new button is pressed or released, ready for a new label to be written
   if( buttonJustPressed || buttonJustReleased )
   {
     lcd.setCursor( 4, 1 );
     lcd.print( "            " );
   }
   //show text label for the button pressed
   switch( button )
   {
      case BUTTON_NONE:
      {
         break;
      }
      case BUTTON_RIGHT:
      {
         lcd.setCursor( 4, 1 );
         val += 1;

         break;
      }

for example when i press right the value changes for the right but not globally ! do I need to use pointers?

Ok i fixed it now BUT it now when i press Up it continues to increment non-stop !

jasperfly: Ok i fixed it now BUT it now when i press Up it continues to increment non-stop !

Look at the change state example in the IDE:- File -> Examples -> 02Digital -> ChangeStateDetector