I have had a lot of issues reading a reliable signal from the Farmduinos digital pins to control relays etc.
I have found two solutions that work:
- Use the 4 servo pins as they get a very reliable signal - easy but means you only can use a 4 switch relay
- Put through a second arduino and write an algorithm to clense, sample, measure and find a valid signal. Plug your relay into that arduino and control it from there - harder and if you are plugging your arduino into a farmduino peripheral slot you will need use a 24v to 12v converter and 4k7 resistors between the gnd and digital pins.
Hope that helps someone