strubbeling program servo's

Hi everyone,
We need help making an automatic cat door.
Unfortunately, my program does not. I don’t know where it goes wrong.
What I’m trying to make: I’m an automatic door for the cats. At night the cats are not allowed to go inside and outside. This is controlled with a light transistor, when it Shimmers, the door will be locked. In the morning the door needs to be unlocked. The door is locked with 2 metal discs (on 2 axles with 2 mounted servo motors) that a quarter turn, and so the door block. Also, I would like to 4 other manual modes. (these are not depending on the light in the air) :
the first “IN”: the cats may only inside (1e servo under 180 °, the other under 1 °)
the second “OUT”: the cats may only go out (1st servo under 1 °, the other under 180 °)
the third “INOUT”: the cats are allowed in and out (the two servos engines under 1 °)
the fourth “CLOSE” : door locked (the two servos engines under 180 °) to the function to select I use a rotary switch).

thanks for your time!

Simon and Thomas
from Belgium

de_deur.ino (14.1 KB)

Please post your code enclosed in Code Tags </>.

What’s your question?

Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

We need to see how you have wired your sensor and servo unit, also how are you providing power to your Arduino and Servos?

What model Arduino are you using?

Thanks.. Tom.. :slight_smile: