Struggling getting arduino to do "2" thing at "once"

NickRehm

Member
@Rcjetflyer2

i need some help here pls.

when the time comes to rotate the egg tray (servo)
this servo does not read it's potentiometer.... it's more of a heavily geared motor with a built in motor controller.

i need it to rotate from one position until the dip switch on the other end stop gets pressed...
contact switches are attached to arduino digital pins.
input pins for switches defined as
rightsw
leftsw

View attachment 205509

In whatever 'if' statement you have that triggers every two hours, place a 'while' loop that basically says "while the contact switch is not pressed (0 or 1 on the switch digital input), run the motor at X speed". Inside that while loop, you will need to read the contact switch, and command the motor (pwm signal, or however you are controlling it). You will need the boolean toggle functionality I think I mentioned earlier, so that it runs each switch/motor direction for every other cycle, or toggles between the two directions. Best of luck