Show Posts
Pages: [1]
1  Using Arduino / Networking, Protocols, and Devices / Re: Trouble using Wireless Shield and RN-XV on: July 06, 2012, 09:01:03 pm

It looks like the WiFly is not recieving any data from the arduino, but the arduino is recieving data from the WiFly.

Can you try a simple sketch to check the connection?

E.g try this for your loop:
Code:
void loop()
{
    wifly.terminal();
}

Once the terminal starts, try sending $$$ without a newline from serial monitor. The WiFly should respond with "CMD". After that you can send any of the commands from the WiFly user manual. "set uart mode 0" will turn echo back on so you can see what you are typing.

If you can't get the "CMD" response then there's something wrong with the wiring for the serial connection, or the pins being supplied to software serial.

Alright, I'll try that later this evening when I get home.  I did check all the connections and I know they're done right.  However, I do wonder if this is a similar case as using the XBEE explorer regulated where it doesn't work with it for some reason or another (I don't think anyone's actually figured out why, but I could be wrong.)  The XBEE shield (what I'm using) does have other "stuff" on it, so it's not just a straight through on the signal pins.  A lot of people suggest using the plain old XBEE breakout boards instead of of the explorer boards, so that's why I'm wondering whether this is a similar situation.

I'll let you know what happens when I do the above test.

dhunt,

I have put following code in my sketch as you mentioned in your post. But the arduino still is not able to communicate to RN-XV. Can you please help me out....

Code:
#include <WiFlyHQ.h>

#include <SoftwareSerial.h>
SoftwareSerial wifiSerial(8,9);

//#include <AltSoftSerial.h>
//AltSoftSerial wifiSerial(8,9);

WiFly wifly;

/* Change these to match your WiFi network */
const char mySSID[] = "XYZ";
const char myPassword[] = "abc";

char buf[80];

void setup()
{
    Serial.begin(115200);
    Serial.println(F("Starting"));
    Serial.print(F("Free memory: "));
    Serial.println(wifly.getFreeMemory(),DEC);

    wifiSerial.begin(19200);
    if (!wifly.begin(&wifiSerial, &Serial)) {
        Serial.println(F("Failed to start wifly"));
wifly.terminal();
    }

    /* Join wifi network if not already associated */
    if (!wifly.isAssociated()) {
/* Setup the WiFly to connect to a wifi network */
Serial.println(F("Joining network"));
wifly.setSSID(mySSID);
wifly.setPassphrase(myPassword);
wifly.enableDHCP();
wifly.save();

if (wifly.join()) {
    Serial.println(F("Joined wifi network"));
} else {
    Serial.println(F("Failed to join wifi network"));
    wifly.terminal();
}
    } else {
        Serial.println(F("Already joined network"));
    }

    wifly.setBroadcastInterval(0); // Turn off UPD broadcast

    //wifly.terminal();

    Serial.print(F("MAC: "));
    Serial.println(wifly.getMAC(buf, sizeof(buf)));
    Serial.print(F("IP: "));
    Serial.println(wifly.getIP(buf, sizeof(buf)));

    wifly.setDeviceID("Wifly-WebServer");

    if (wifly.isConnected()) {
        Serial.println(F("Old connection active. Closing"));
wifly.close();
    }

    wifly.setProtocol(WIFLY_PROTOCOL_TCP);
    if (wifly.getPort() != 80) {
        wifly.setPort(80);
/* local port does not take effect until the WiFly has rebooted (2.32) */
wifly.save();
Serial.println(F("Set port to 80, rebooting to make it work"));
wifly.reboot();
delay(3000);
    }
    Serial.println(F("Ready"));
}

void loop()
{
    wifly.terminal();
}
Pages: [1]