WiFly GSX Breakout Adhoc + UDP

I just received the WiFly GSX Breakout.

My ultimate goal is to have the WiFly serve an adhoc network and communicate to a ipod touch using the UDP protocol.

I got this all working with the WiShield from asynclabs.com. But they just shut down their store. (too bad)

So i am now using the TX/Rx on the WiFly GSX Breakout with this driver

http://arduinology.tumblr.com/

I think i got the adhoc part via software working with the code below.

Now I need to figure out how to establish the UDP communication.

/*

  • WiFly_Device Test Platform

  • A simple tester for communicating with the WiFly GSx RN-131b/g series.

  • LGPL 2.0

  • Tom Waldock, 2011

*/

#include <WProgram.h>

#include <Streaming.h>

#include <NewSoftSerial.h>

#include “WiFlySerial.h”

#include “MemoryFree.h”

//#include “Credentials.h”

#define ConsoleSerial Serial

// Pins are 3 for INCOMING TO Arduino, 2 for OUTGOING TO Wifly

// Arduino WiFly

// 3 - receive TX (Send from Wifly, Receive to Arduino)

// 2 - send RX (Send from Arduino, Receive to WiFly)

WiFlySerial WiFly(2,3);

#define REQUEST_BUFFER_SIZE 100

#define HEADER_BUFFER_SIZE 150

#define BODY_BUFFER_SIZE 100

char bufRequest[REQUEST_BUFFER_SIZE];

char bufHeader[HEADER_BUFFER_SIZE];

char bufBody[BODY_BUFFER_SIZE];

// Wifi parameters

//char passphrase = “myPassword”;

char ssid = “testN”;

char ntp_server = “nist1-la.ustiming.org”;

//Server server(80);

void setup() {

Serial.begin(9600);

Serial.println(“Starting WiFly Tester.” );

Serial << “Free memory:” << freeMemory() << endl;

WiFly.setDebugChannel( (Print*) &Serial);

WiFly.begin();

Serial << “Starting WiFly.” << endl;

Serial << “Free memory:” << freeMemory() << endl;

Serial << “WiFly begin mem:” << freeMemory() << endl;

// if not connected restart link

if (! WiFly.isConnected() ) {

WiFly.SendCommand(“set wlan join 4”,“AOK”);

WiFly.setSSID(ssid);

WiFly.SendCommand(“set wlan chan 1”,“AOK”);

WiFly.SendCommand(“set ip address 169.254.1.1”,“AOK”);

WiFly.SendCommand(“set netmask 255.255.0.0”,“AOK”);

WiFly.SendCommand(“set dhcp 0”,“AOK”);

WiFly.SendCommand(“save”,“AOK”);

WiFly.SendCommand(“reboot”,“AOK”);

} // if not connected

Serial << “After Setup mem:” << freeMemory() << endl ;

WiFly.exitCommandMode();

// clear out prior requests.

WiFly.uart.flush();

while (WiFly.uart.available() )

WiFly.uart.read();

// server.begin();

}

char chOut;

void loop() {

// Terminal routine

// Always display a response uninterrupted by typing

// but note that this makes the terminal unresponsive

// while a response is being received.

while(WiFly.uart.available() > 0) {

Serial.print(WiFly.uart.read(), BYTE);

}

if(Serial.available()) { // Outgoing data

WiFly.uart.print( (chOut = Serial.read()) , BYTE);

Serial.print (chOut, BYTE);

}

} //loop

Hello Stephan,

do you have any pictures of your setup with wifly gsx breakout ?

Hey!

I am trying to do something similar and was wondering if you had success connecting over adhoc network using UDP.

Thanks,

McKinnley

Hey!

Did u ever figure it out? I would like to know the same thing :smiley: