Hello.
It looks like you are only sending one pulse width in your second program, so the state of the switch will never change. Try using this for your loop:
void loop() {
myservo.writeMicroseconds(2000); // Send 2ms pulses for 5 seconds
delay(5000);
myservo.writeMicroseconds(1000); // Send 1ms pulses for 5 seconds
delay(5000);
}
If that does not work, could you post some pictures of your setup that shows all of your connections?
For future reference, if you want to operate a relay using a digital signal like in your first post, you could just use a basic relay carrier, like this product:
- Patrick
