Hello fellow arduino programmers,
I'm currently working on a project, in which I have several programs, that all work independently but
when I try to combine them (execute them in a certain order) It mixes stuff up.
As an example my Step1 starts a motor, then I can stop it again by pressing a button. My Step2 does a calibration of a seperate module.
What my program does at the moment:
Step1 starts, Motor starts, moves to Step2, I cannot stop the motor anymore.
What I've done in my code (the simple steps are Programs that I have declared further down in the code but work properly), The Display(); stuff is just to display me in what Step the program currently is.
I tried to force the programs with the if statements to go step by step (not really successefull).
void loop() {
StartMachine=1;
// Linearachse raus
if(StartMachine == 1){
TextDisplay = String ("Step1");
Display();
Step1();
MotorRaus =1;
StartMachine =0;
Serial.println(MotorRaus);
}
if((StartMachine ==0) &&(MotorRaus ==1)){
TextDisplay = String ("Step2");//Kalibrierung
Display();
Step2();
FertigDeklariert =1;
MotorRaus =0;
}
if((FertigDeklariert ==1)&&(MotorRaus==0)){
TextDisplay = String ("Step3");//Einstellung
Display();
Step3();
FertigEinstellung =1;
FertigDeklariert =0;
}
if((FertigDeklariert ==0)&&(FertigEinstellung ==1)){
TextDisplay = String ("Step4");//linearachse rein
Display();
Step4();
FertigEinstellung =0;
}
Display();
}
I hope anyone can help me with that. Thanks for your time and have an awesome day.
best regards,
Sascha