Go Down

Topic: creating an AdHoc ntwork with RN-XV WiFly Module (Read 604 times) previous topic - next topic

Apr 16, 2013, 03:50 pm Last Edit: Apr 16, 2013, 03:52 pm by sadiqawos Reason: 1
I got an RN-xv WiFly module a few weeks ago and i have been trying to get it working properly. My goal is to create a adhoc network that allows me to  access some accelerometer readings from my smartphone. I was able to scrape together a test program from a few general RN-XV sample codes i found, but nothing seems to really work.
Code: [Select]
#include <SPI.h>
#include <SoftwareSerial.h>
#include <WiFlyHQ.h>

#define rxPin 2
#define txPin 3

SoftwareSerial wifiSerial( rxPin, txPin);

char ssid[] = "XVAdHoc";

WiFly wifly;

void setup()
{
 Serial.begin(9600);
 Serial.println("Wifly AdHoc");
 wifiSerial.begin(9600);
 wifly.begin(&wifiSerial);
 
 if(!wifly.createAdhocNetwork(ssid,2))
 {
   while(1)
   {
     Serial.println("Failed to create network, handle error properly?");
   }
 }
 Serial.println("Network Created");
 Serial.print("UpTime: ");
 Serial.println(wifly.getUptime());
 
}

void loop()
{
 /*
 wifly.setIpProtocol(WIFLY_PROTOCOL_UDP);
 wifly.sendto("Hello, world", "192.168.1.100", 2042);
 */
 wifly.setIpProtocol(WIFLY_PROTOCOL_TCP);
 wifly.open("192.168.1.100",8042);
 wifly.println("Hello, world!");
 wifly.close();
}

Any help or advice is welcome.
Thanks

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