Centre stepper using limit switches

before I try to do this and end up spending the next few weeks going round in circles I thought i would see if possible.
I want to use a stepper motor with a A4988 driver with 2 limit switches lower and upper limit. what I want to do is when powered up the stepper will move to lower limit set that to 0 then move to upper limit and store total steps to that point, then the motor will go to the centre and display step counter.
I have minimal programming knowledge but I can get there eventually but looking to see if what I am aiming to do is possible before I waste my time.
TIA

Sure, Pretty easy to do depending on what you have for limit switches, how they are mounted and how they are connected to the Arduino. That is a hint for detail and a schematic drawing.
Paul

Absolutely.
You don’t really need two switches, as long as you know where one of the switches is on the extent of motion.

(in some ways, it might be better placed somewhere between the limits, so the step counter can be recalibrated whenever the action passes the switch.)
Use a good quality high precision sensor (e.g. optical or hall effect), so the reference position is as accurate as possible.

I have a polar coordinate plotter using steppers and that is how I home the radius axis. Take the motor to one limit switch, set the count to 0, take the motor to the other limit switch counting steps as I go, note the new count at the other limit switch, divide the new count by 2 and move the motor to that position. Then set the position to 0 (home for that axis).

sorry for the lack of detail but it was a purely theoretical question before i go to the trouble of printing a mount for 2 contact limit switches the accuracy does not need to be exact it is for a rough positioning prior to turning a air variable capacitor to tune a antenna. in reality i have a CNC shield to one stepper using the x axis and 2 contact switches one either side of the shaft with a 3d printed collar so limiting the movement to a max of 180 degrees. these will be connected to the x and y limits on the shield or pins d9 and d10. now I know it is possible (for some lmao) I will design the mount for the cap switches and the motor and then see if i can find a sketch to learn from.