#define DIR 6
#define STEP 7

void setup() 
{
  DDRD |= 1 << DIR;
  DDRD |= 1 << STEP;

  DDRB &= ~(1<<5);
  PORTB |= 1<<5;
  DDRB &= ~(1<<4);
  PORTB |= 1<<4;

}

void loop() 
{
  if((PINB & (1<<5)) == 0)
  {
    PORTD |= 1<<DIR;
    PORTD |= 1 << STEP;
    delay(200);
    PORTD &= ~(1 << STEP);
    delay(200);
  }

  if((PINB & (1<<4)) == 0)
  {
    PORTD &= ~(1<<DIR);
    PORTD |= 1 << STEP;
    delay(200);
    PORTD &= ~(1 << STEP);
    delay(200);
  }
}
A4988