This is the code I've written probably did not understand well what I had to do, I am newbie
#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;
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();
unsigned long currentTime;
unsigned long buttonPressedMillis = 0;
}
void loop()
{
currentTime = millis();
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) // 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
{
buttonPressedMillis = currentTime;
}
if(buttonPressedMillis != 0 && currentTime - buttonPressedMillis >=2000)
{
stepper.disableOutputs();//I want to delay this action against reading (val_1 == HIGH)
buttonPresedMillis = 0;
}
}
AND THIS IS THE ERROR I RECEIVE:
Control_motor_start_stop_si_acceleratie_cu_doua_butoane_push.ino: In function 'void loop()':
Control_motor_start_stop_si_acceleratie_cu_doua_butoane_push:27: error: 'currentTime' was not declared in this scope
Control_motor_start_stop_si_acceleratie_cu_doua_butoane_push:41: error: 'buttonPressedMillis' was not declared in this scope
Control_motor_start_stop_si_acceleratie_cu_doua_butoane_push:43: error: 'buttonPressedMillis' was not declared in this scope
Control_motor_start_stop_si_acceleratie_cu_doua_butoane_push:46: error: 'buttonPresedMillis' was not declared in this scope