System slows down when having several loops running at the same time

For this project I have to run several motors and LED’s at the same time. When the LDR reads a value when it is dark, a stepper motor, a servo motor, a geared DC motor and LED’s are activated.

The problem what I notice here, is that the system slows down as soon as I run the loops together at the same time.
For example, my servo moves just as slow as the system reads the values of the LDR.
The servo should move a lot quicker and the values of the LDR should be read continuously.

The loops only work smooth when I run one loop at the time. I have tried several ways of writing the code but they all seem to have the same problem in the end. I have read many forums and searched already for days for the answer, but I just cannot find the right solution.

Could someone please help me out with this?

You can find the code in the attachment!

sterrennachtcopy.ino (8.57 KB)

Not sure that this will help, but you have,

unsigned long currentMillis = millis();

at the beginning of every function. Usually that is, only, in loop() so that loop() controls the timing.

Stepper motors ‘block’ until their move is finished so

void steppermotorfunction() {
  if (sensorvalue < 400) {
    steppermotor->step(150, FORWARD, SINGLE);

the step() function will take a bit of time to complete and once done, it will return control

Thank you so so much @blh64 !! You were very right, I'm very happy with your help!

You are welcome. The solution to this problem is to do very small steps each time through the loop and keep track of where you are rather than one big move. Have a look at Demonstration code for several things at the same time. It will give you an idea about how to do it