Ok, I got onto it and modified your code, Robin2. Basically just tripled it for 3 motors and 6 buttons. here it is:
//Manual control for a CNC with the same stepper driver pinout(step&dir) as for GRBL
byte directionPinX = 5;
byte stepPinX = 2;
byte directionPinY = 6;
byte stepPinY = 3;
byte directionPinZ = 7;
byte stepPinZ = 4;
byte buttonCWXpin = 8;
byte buttonCCWXpin = 9;
byte buttonCWYpin = 10;
byte buttonCCWYpin = 11;
byte buttonCWZpin = 12;
byte buttonCCWZpin = 13;
boolean buttonCWXpressed = false;
boolean buttonCCWXpressed = false;
boolean buttonCWYpressed = false;
boolean buttonCCWYpressed = false;
boolean buttonCWZpressed = false;
boolean buttonCCWZpressed = false;
unsigned long curMillis;
unsigned long prevStepMillis = 0;
unsigned long millisBetweenSteps = 25; // milliseconds
void setup() {
Serial.begin(9600);
Serial.println("ManualCNC");
pinMode(directionPinX, OUTPUT);
pinMode(stepPinX, OUTPUT);
pinMode(buttonCWXpin, INPUT_PULLUP);
pinMode(buttonCCWXpin, INPUT_PULLUP);
pinMode(directionPinY, OUTPUT);
pinMode(stepPinY, OUTPUT);
pinMode(buttonCWYpin, INPUT_PULLUP);
pinMode(buttonCCWYpin, INPUT_PULLUP);
pinMode(directionPinZ, OUTPUT);
pinMode(stepPinZ, OUTPUT);
pinMode(buttonCWZpin, INPUT_PULLUP);
pinMode(buttonCCWZpin, INPUT_PULLUP);
}
void loop() {
curMillis = millis();
readButtons();
actOnButtons();
}
void readButtons() {
buttonCCWXpressed = false;
buttonCWXpressed = false;
if (digitalRead(buttonCWXpin) == LOW) {
buttonCWXpressed = true;
}
if (digitalRead(buttonCCWXpin) == LOW) {
buttonCCWXpressed = true;
}
buttonCCWYpressed = false;
buttonCWYpressed = false;
if (digitalRead(buttonCWYpin) == LOW) {
buttonCWYpressed = true;
}
if (digitalRead(buttonCCWYpin) == LOW) {
buttonCCWYpressed = true;
}
buttonCCWZpressed = false;
buttonCWZpressed = false;
if (digitalRead(buttonCWZpin) == LOW) {
buttonCWZpressed = true;
}
if (digitalRead(buttonCCWZpin) == LOW) {
buttonCCWZpressed = true;
}
}
void actOnButtons() {
if (buttonCWXpressed == true) {
digitalWrite(directionPinX, LOW);
singleStep();
}
if (buttonCCWXpressed == true) {
digitalWrite(directionPinX, HIGH);
singleStep();
}
if (buttonCWYpressed == true) {
digitalWrite(directionPinY, LOW);
singleStep();
}
if (buttonCCWYpressed == true) {
digitalWrite(directionPinY, HIGH);
singleStep();
}
if (buttonCWZpressed == true) {
digitalWrite(directionPinZ, LOW);
singleStep();
}
if (buttonCCWZpressed == true) {
digitalWrite(directionPinZ, HIGH);
singleStep();
}
}
void singleStep() {
if (curMillis - prevStepMillis >= millisBetweenSteps) {
prevStepMillis += millisBetweenSteps;
digitalWrite(stepPinX, HIGH);
digitalWrite(stepPinX, LOW);
}
if (curMillis - prevStepMillis >= millisBetweenSteps) {
prevStepMillis += millisBetweenSteps;
digitalWrite(stepPinY, HIGH);
digitalWrite(stepPinY, LOW);
}
if (curMillis - prevStepMillis >= millisBetweenSteps) {
prevStepMillis += millisBetweenSteps;
digitalWrite(stepPinZ, HIGH);
digitalWrite(stepPinZ, LOW);
}
}
The problem is that when I push the buttons, the motors only jerk a little instead of turning for real. They turn a tiny bit per push, and there is some weird phenomenom also that not every push produces the same action. If I do nothing for a couple of seconds the movement of the motors is bigger when pushing a button again- they turn more. I write motorS because there are 2 per axis.
What I am happy with is that the required motors turn with the right buttons, hooray 
For me this looks like there is some other problem than coding error, maybe just some wiring is wrong. Once I touched the pins of the switches I used for testing, and all of the motors started to turn slowly. I have a very noisy power supply and a weak less noisy one to test the things now, so maybe they are the ones to blame.
What do you guys think?