how to check a state of a push button every 2 ms

i need to use this and learn how to use it with more than 2 ms please help!

I do not know any ways to use PWM for checking button states. Can you link to the references you're referring to that mention it?

Where did you read this? It doesn't make much sense. PWM is an output method. Buttons are input.

i did not find the page , but here is what i need , can you help me with that?

hossamsh: i did not find the page , but here is what i need , can you help me with that?

Where is what you need? Why does simply checking it every time loops() runs as usual not work?

Don't go edit your post like that. Now @DrAzzy and I look like we're idiots talking about something not even there.

If you want to read a button every 2ms, look at the Blink Without Delay example but use micros instead of millis and read your button instead of blinking an LED.

If that's not exactly what you meant, then perhaps be a little more verbose and fully describe exactly what you want to do.

unsigned long Micros13;
unsigned long currentMicros;
unsigned long SwitchMicros;
unsigned long debounceMicros = 2000UL; //2000us -> 2ms

boolean repeat13 = true; //repeat this sequence

const byte mySwitch = 2;

//**********************************************************************

void setup()
{
  Serial.begin(9600);

  pinMode(13, OUTPUT);

  pinMode(mySwitch, INPUT_PULLUP);


} //  >>>>>>>>>>>>>> E N D  O F  s e t u p ( ) <<<<<<<<<<<<<<<<<


void loop()
{
  //leave this line of code at the top of loop()
  currentMicros = micros();

  //***************************
  //to see if code is blocking, toggle pin 13 every 200mS
  if (CheckTime(Micros13, 200000UL, repeat13))
  {
    //toggle pin 13
    digitalWrite(13,!digitalRead(13));
  }

  //***************************
  //is it time to check the switches?
  if (CheckTime(SwitchMicros, debounceMicros, true))
  {
    checkSwitches();      
  } 

  //***************************
  //put other non-blocking stuff here


} //  >>>>>>>>>>>>>> E N D  O F  l o o p ( ) <<<<<<<<<<<<<<<<<


//======================================================================
//                      F U N C T I O N S
//======================================================================

//**********************************************************************
//Delay time expired function
boolean CheckTime(unsigned long &lastMicros, unsigned long wait,boolean restart) 
{
  //is the time up for this task?
  if (currentMicros - lastMicros >= wait) 
  {
    //should this start again? 
    if(restart)
    {
      //get ready for the next iteration
      lastMicros += wait;  //get ready for the next iteration
    }
    return true;
  }
  return false;

} // END of CheckTime()

//**********************************************************************
//switches are checked every debounceValue micro seconds 
void checkSwitches()  
{
  //Your switch code

} //END of checkSwitches()

//**********************************************************************

//======================================================================
//                      E N D  O F  C O D E
//======================================================================