The DFRobot Relay Shield for Arduino is used differently than most shields. To get power to it you need to:
Unplug your USB cable used to upload your program and provide an external power source. I used 7.4v LiPo or 11.1v LiPo plogged into the power jack.
To communicate with your XBEE or bluetooth module the shield uses the serial port so don’t use pins for TX and RX, simply use Serial.read() and Serial.print()
After you upload your program, remove the USB cable and the “prog” switch to “Run” mode. Back to “Prog” when uploading a new program…and so-forth.
Here is a simple LED on off to test it. I used a smartphone bluetooth app to send the data.
while (1)
{
if (Serial.available())
{ //check if there’s any data sent from the remote bluetooth shield
recvChar = Serial.read();
Serial.print("Command = ");
Serial.print(recvChar);
if (recvChar == '1')
{
LEDON();
Serial.println("; LED is ON");
}
else if (recvChar == '0')
{
LEDOFF();
Serial.println("; LED is OFF");
}
}