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)