Go Down

Topic: Arduino Uno + RN-XV + XBee Shield = Doesn't Work (Read 628 times) previous topic - next topic

So, recently I have been trying to use the Roving Networks RN-XV (https://www.sparkfun.com/products/10822) and the XBee Shield (https://www.sparkfun.com/products/9976) and the WiflyHQ library to create an ad-hoc network. The purpose is to use it for telemetry on a quadcopter.

But, This doesn't seem to work. The adhoc network is not created (I can't see it with a macbook). And it takes a while to setup the serial connection to the RN-XV (as seen by it flashing three times after a long delay). This makes me think that there is some type of watchdog timer in wifly.begin() that forces it to return after it retries a few times. Do you have any ideas on how to get it to work? Anyone used this combination before? Example code would be great.

This is my code:

Code: [Select]
    #include <Arduino.h>
    #include <WiFlyHQ.h>
   
    WiFly wifly;
   
    void setup()
    {
        pinMode(13, OUTPUT);   
       
        Serial.begin(9600);
        wifly.begin(&Serial, NULL);
        delay(1000);
       
        wifly.setIpProtocol(WIFLY_PROTOCOL_UDP);
        //Serial.println("Done Setup");
       
        digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
        delay(250);               // wait for a second
        digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
        delay(250);               // wait for a second
        digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
        delay(250);               // wait for a second
        digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
        delay(250);               // wait for a second
        digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
        delay(250);               // wait for a second
        digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
        delay(250);               // wait for a second
       
        //Serial.println("Attempting to Setup ADHOC Network...");
        wifly.createAdhocNetwork("wifly", 10);
       
        delay(4000);
        digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
        delay(250);               // wait for a second
        digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
        delay(250);               // wait for a second
        digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
        delay(250);               // wait for a second
        digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
        delay(250);               // wait for a second
        digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
        delay(250);               // wait for a second
        digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
        delay(250);
        digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
        delay(250);               // wait for a second
        digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
        delay(250);
        digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
        delay(250);               // wait for a second
        digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
        delay(250);
       
       
    }
    void loop()
    {
        if (wifly.available() > 0)
        {
            if(wifly.read() == 'b')
            {
               digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
               delay(1000);               // wait for a second
               digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
               delay(1000);               // wait for a second
            }
        }
    }   

epinc

Couple of quick things.

You should try the RN-XV just buy itself without the Arduino. Download the data sheet on it. Supply 3.3V and Ground, and then there is a pin (pin 8? not sure) that you cycle every second 3 times to reset it and put it into ad-hoc mode. You should see the ad-hoc network then (it takes some time for it to appear). Verify the procedure using the data sheet.

Also, I don't know about the XBEE sheild, but I used the Arduino Wireless SD Shield ( http://www.amazon.com/Arduino-Wireless-SD-Shield/dp/B006RATC2E ) and if you are using Software Serial, you need to bend away pins 1 and 2 and runs jumpers from 1 and 2 to whatever TX and RX pins you are using for Software Serial. You also have make make sure the USB/Micro switch is in the right position.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy