Hello!! I have a question about how to handle this situation; I am making a camera slider. As you can see, when the program recieves a command to go to the right, it starts to run a sliding motor, a pan motor which rotates the camera from left to right, and a tilt motor, which until the middle of the sliding path gradually tils the camera downwards to position -2000 and afterwards starts to tilt it back up to position 0. I want the three motors to work silmutaneously. I am not sure if first writing for the stepperTilt to go to position 2000, and then under it writing for it to go back to position 0 will work in order. Should i make a separate conditional statement for it and how could i do that without interrupting the work of the other two motors? Thank you a ton for any help!
Here is a simple portrayal of the movements;
if (bluetoothSerial.available()) {
String command = bluetoothSerial.readString();
if (command == "right") { //if it recieves "right", there three motors
stepperSlide.setSpeed(3000); begin to work simultaneously
stepperSlide.moveTo(60000);
stepperSlide.run(); // the sliding movement
stepperPan.setSpeed(500);
stepperPan.moveTo(4000);
stepperPan.run(); // panning of the camera
stepperTilt.setSpeed(300);
stepperTilt.moveTo(2000);
stepperTilt.run(); //tilting downwards initially
stepperTilt.setSpeed(300);
stepperTilt.moveTo(0);
stepperTilt.run(); //then the tilt goes back to position 0.. Here is where the
problem lies.. Could that work?
}
//Should i use something like this? But i think that would interrupt the upper if statement :/
if (stepperTilt.distanceToGo() != 0) {
stepperTilt.setSpeed(300);
stepperTilt.moveTo(0);
stepperTilt.run();
}
