Camera Slider project, slider length problem

Hello everyone

I am following this link in youtube and bought all the hardware which is needed for this project.
uploaded the codes and everything worked fine except one thing :

My camera slider has the option of having a length of 50CM , 100CM and 150CM.
in the options of the project, the length of the slider is a fixed number which you can change in this part:

//runs the stepper to move a certain distance in a specified time limit
void durationSlide(int duration)
{
  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(10,0);
  display.println("Running");
  display.drawLine(0,15,127,15,WHITE);
  display.display();
  float chassisLength = 22500;
  int actualSteps=0;
  float moveSpeed = chassisLength/duration;  //steps per second
  stepper.enableOutputs();//enable motor
  int pos = stepper.currentPosition();
  stepper.moveTo(pos+chassisLength);
  stepper.setSpeed(moveSpeed);
  while(stepper.distanceToGo()>0){
    stepper.runSpeed(); 
  }
  stepper.disableOutputs();  //disable motor
  delay(2000);
  zeroSystem();
}

and this value:

float chassisLength = 22500;

now my question is :
can anybody help by adding a code into the project so we can select the length of the slider between these three options:

Slider Length:

1)-50 CM
2)-100 CM
3)-150 CM

and actually my knowledge about arduino is very limited, i watched many tutorials on the internet to be able to solve this problem by myself but I've reached the point that this problem needs a lot knowledge regarding arduino which takes lots of time for me. I'm a photographer and already confused by the codes and not good with computers and stuff at this depth of knowledge. so I would appreciate if someone in here could tell me what should I do to fix this problem.

Thank you for your time :slight_smile:

What have you tried? Post your code and we will help. Ask people to write your code for you and they will not unless you hire them.

Did you try reaching out to the original code creator?

Seems he has a pretty rich menu system in his code apparently so for someone who understands how this part of the code works, it's probably not a lot of work to get it done and add an extra configuration menu that would set the chassisLength

(exploring his code and playing around would require building this to understand exactly what his functions offer, so won't be able to help)

You have run this with chassisLength set to 22500
How does this relate to your selected 50/100/150 lengths?

How doe you see the user selecting between the 3 lengths?

blh64:
What have you tried? Post your code and we will help. Ask people to write your code for you and they will not unless you hire them.

J-M-L:
Did you try reaching out to the original code creator?

Seems he has a pretty rich menu system in his code apparently so for someone who understands how this part of the code works, it's probably not a lot of work to get it done and add an extra configuration menu that would set the chassisLength

(exploring his code and playing around would require building this to understand exactly what his functions offer, so won't be able to help)

vinceherman:
You have run this with chassisLength set to 22500
How does this relate to your selected 50/100/150 lengths?

How doe you see the user selecting between the 3 lengths?

Wow guys!

thank you for the fast respond!

I tried to reach the person who wrote it but he is not available since 6 months ago, so this option is i guess not availble.

the number for my slider at 150 CM is : 43500
for the step motor to stop at 50 CM the number is 14500
and for the 100 CM the number is 29000

I want to add an option in the menu to be able to select the length and when user select the 50 CM on the menu, the number 14500 associate to the "chassisLength" in the program. you think that's possible ?

Is there any chance of adding limit switches to the system to detect when the camera is at or near the ends of the slider

UKHeliBob:
Is there any chance of adding limit switches to the system to detect when the camera is at or near the ends of the slider

as the slider has to be taken apart to be able to add or subtract the length of it, I'm afraid it's not possible, so I have to send the exact steps needed for the step-motor to go through the length and stop at the end.
I have the numbers for this matter but don't know how to point the program to them in the menu

vinceherman:
How doe you see the user selecting between the 3 lengths?

The easiest way would be to leverage the existing menu system. if you look at the code and the video pointed in the first post, it does not seem very difficult to add new entries into the menu

this is where he defines his main menu

And if you select the first entry, it takes you to a sub-menu

Could be something similar to pick the length. but would require diving into the code and building a minimal system to experiment... that's why I think it's worth contacting the author, it might be super easy for him - may be like 15 min of work if the code is clean and there is no dependency all over the place .