Combining 3 codes into 1

We are working on a project using stepper motors, a strain gauge and an LDR. The goal is to use the strain gauge as a scale, which, if a certain weight is applied/voltage is read, the stepper motors will start turning (and open a lock and open a gate). If then, after the motors have been turned (and so the gate has been opened), a laser which is continuously focused on the LDR is crossed, the LDR will measure a voltage difference and will reverse the rotation of the motors and close the gate.

Our problem is that we have 3 individual codes that work each of the individual components flawlessly (the LDR, the motors and the strain gauge), but we can’t seem to get the different codes implemented into each other.

The first problem we encountered was getting the steppermotor working in the combined script. For example, in the short code below we have managed to get a small LED (analog A1) burning if a certain value of the strain gauge (sensorvalue) is reached, if we then want to get the motor running we unfortunately stumble upon a problem and nothing works.

void loop() {
int sensorValue = analogRead(A1);
if(analogRead(A1) < 60){
digitalWrite(13, HIGH);
} else{
digitalWrite(13, LOW);

We would appreciate any help,
Many thanks.

So you show us the code that works, but not the code you are having problems with.

Well, great job on the code you showed us. I'm not sure what you want us to do now.

This demo shows a simple way to combine programs.