Recently, I made a big structure for my solar panel and solar collector, and I used two 230V single-phase AC motors. The only way I can control the motors is using relays. I added some limit switches in series to the motors, and they are normally closed. I built the circuit so the electronics part has finished. I started the coding and I got stuck with main part, where the motor controlling happens. I used 4 photoresistors, and I looked for the differencies between them, and the motors will move according to them. Now the problem is that you don't have the same control over the motors, like a servo or a stepper motor. You can't tell the motor how far does it has to go. You can only turn them on or off with digitalWrite. But how can I make a function for that controlling? I searched on the internet for these types of controlling, but I only found functions with servos.