static int step = 4;
static int dir = 3;
static int button1 = 7;
static int button2 = 6;

void setup() {
  Serial.begin(9600);
  pinMode (step, OUTPUT);
  pinMode(dir, OUTPUT);
  pinMode(button1, INPUT);
  pinMode(button2, INPUT);
}

void loop() {
  int zasuk = 10;
  //Serial.print(digitalRead,button)
  if (digitalRead(button1) == 1)
  {
    //pritisk na gumb 1x
    digitalWrite(dir, HIGH);//smer vrtenja
    for (int i = 0; i < zasuk; i++) {
      korak();
      delay(10);
    }
    delay(500);// čas za izpust tipke
  }
  if (digitalRead(button2) == 1)
  {
    digitalWrite(dir, LOW);
    for (int i = 0; i < zasuk; i++) {
      korak();
      delay(10);
      // en pulz
    

    }
    delay(500);
  }

}


  void korak () {
    digitalWrite(step, HIGH);
    delayMicroseconds(10);
    digitalWrite(step, LOW);
    delayMicroseconds(10);
  }
A4988