static int step = 4;
static int dir = 3;
static int button = 7;
static int button2 = 6;
void setup() {
Serial.begin(9600);
pinMode(step, OUTPUT);
pinMode(dir, OUTPUT);
pinMode(button, INPUT);
pinMode(button2, INPUT);
}
void loop() {
int zasuk = 113;
if (digitalRead(button) == 1) {
digitalWrite(dir, HIGH);
for (int i = 0; i < zasuk; i++) {
korak();
delay(10);
}
delay(500);
}
if (digitalRead(button2) == 1) {
digitalWrite(dir, LOW);
for (int i = 0; i < zasuk; i++) {
korak();
delay(10);
delay(500);
}
}
void korak() {
digitalWrite(step, HIGH);
delayMicroseconds(10);
digitalWrite(step, LOW);
delayMicroseconds(10);
}
}