I answer with the same generalised unspecific way what you have to modify
This is just to demonstrate that your generalised questions demand too much. You have ask specific questions to reduce te work of your potential helpers to that part that is really nescessary.
Nobody here will write ready to use code for you
nor will write a 10 pages tutorial to explain all possible details which you might already know
So here is a generalised answer:
You have to use a stepper-motor-library which is either able to create the step--pulses in the backround or you have to modify the code to work non-blocking to be able to read in the sensor-data and creating the stepper-pulses at the same time
I'm very sure that this generalised answer does not help
As mentioned above this generalised answer is just to demonstrate that you have to be more specific in your questions
And if you didn't realise yet: converting this code from DC-motor to stepper-motor requires more than just changing 10 lines of code
Please post a schematic of the stepper circuit. Written descriptions are always more ambiguous than a drawing. Hand drawn, photographed and posted is fine. Include all pin names/numbers, components, their part numbers and/or values and power supplies. Clear photos of the wiring are often useful, too.
Here is a simple example that may help. It uses the MobaTools stepper library. It is written for 28BYJ steppers (2048 steps per rev) with a ULN2003 diver.
the problem I see is that you have right(8 9 10 100) and left (4 5 6 7) for the stepper motor but the problem is technically I only have one stepper motor so I cant put pin for right(8 9 10 11) and left (4 5 6 7 ). Thank you for your help so far though.
That was a guess because I had not seen a schematic. I thought that there were 2 DC motors being driven with a driver like a L29x. So I wrote the code to replace 2 motors with 2 motors. A bad guess on my part. My mistake for jumping the gun and assuming.
Though I don't know how you get forward, back, right and left with one motor.
I would hope that you get something useful from the code.
If you only want one motor, delete everything in the code that refers to the leftStepper. Then you will be left with the code for the rightStepper and it is wired to pins 8, 9, 10 and 11.
Does the motor do anything? Like buzz or vibrate?
Do the LEDs on the driver turn on or flash?
How sure are you that the motor is coils are connected to the driver properly?
That means that the driver is not getting signals and/or power. Is there a jumper on the board next to where the power connects? Is the jumper in place?