I want to connect the movement of a servo to a 4 channel relay. The idea is that when for eg, ch1 is switched on, then the servo rotates to 30degrees. If ch2, then 60, if ch3 then 90, if channel 1 again, then back to 30. And I also want to connect this and make it wireless using the esp8266, so that I can choose what channel is high or low based on my choice. Any help?
If the Arduino is driving the relays then a simple
if (outputToRelay1 == LOW) //may be HIGH depending on the hardware
{
servo.Write(30);
}
If the Arduino is reading the relay contacts but not controlling the relays then you need to wire the relay contacts to take an Arduino pin HIGH (or LOW) when the relay is activated and do
if (inputFromRelay1 == LOW) //may be HIGH depending on the hardware
{
servo.Write(30);
}