Hello again, Teodor, sorry for delay, I believe (hope) this modification will work the way you want, let me know if not.
#include <Stepper.h>
#include <AccelStepper.h>
#include <MultiStepper.h>
int buttonPullupPin_0 = 11;
int butonPullupPin_1 = 10;
int val_0 = 0;
int val_1 = 0;
unsigned long timeStart; //NEW
unsigned int timeEnd = 2000; //NEW
bool timing = false, hold = false; //NEW
AccelStepper stepper(AccelStepper::DRIVER, 4, 3);
void setup()
{
pinMode(buttonPullupPin_0, INPUT);
pinMode(butonPullupPin_1, INPUT);
stepper.setMaxSpeed(100);
stepper.setSpeed(90);
stepper.setEnablePin(9);
stepper.disableOutputs();
}
void loop()
{
val_0 = digitalRead(buttonPullupPin_0);
val_1 = digitalRead(butonPullupPin_1);
if (val_0 == HIGH)
{
stepper.enableOutputs();
}
if (val_1 == LOW)
{
stepper.runSpeed(); //I want to continue this action until val_1 == hight plus a certain time delay
}
if(val_1 == HIGH && timing == false) //NEW
{
timeStart = millis(); //NEW
timing = true;
hold = true;
}
if(millis() - timeStart > timeEnd) //NEW
timing = false; //NEW
// NEW___________________________
if(hold == true && timing == false) // here i want after reading the button to delay the execution without stopping action before a certain time then execute the action that is conditioned by reading this state of butonPullupPin_1
{
stepper.disableOutputs();//I want to delay this action against reading (val_1 == HIGH)
hold = false; //NEW
}
}