Library for Due and WiFly GSX Breakout from SparkFun

I had a WiFly working with an Arduino Mega 2560 thanks to the library WiFlySerial from Tom Waldock. But this library use the SoftwareSerial library that is not compatible with Due processor.

For making WiFly work with Due, I use serial communication port Serial1 and I wrote WiflySerial1 library. It is less complete than (but highly inspirited from) Tom' work. You can download it at Comments and feedback are welcome!

I update the library, adding two functions that allow to connect to a web server. Functions are:

    boolean openConnection( char* host, int port = 80, unsigned long connectWaitTime = CONNECT_WAIT_TIME )
    boolean isConnectionOpen()

I add a example WiflyWebClient that show the use of those functions.

Hello Jean-Michel,

First of all thank you for this library, I already used the previous version with the webserver to test the WiFly shield on my Arduino Due. It works very well!

In fact I was just looking how to add client functionality when I saw your update. So I tried it immediatly, unfortunately I got a compilation error: ....Arduino/libraries/WiflySerial1/WiflySerial1.cpp: In member function 'boolean WiflySerial1::openConnection(char*, int, long unsigned int)': ....Arduino/libraries/WiflySerial1/WiflySerial1.cpp:438: error: 'itoa' was not declared in this scope

I did not have time to dig in to it now, but I will try tomorrow , I asume a library (for itoa) has to be added.

Best regards, Henk

…Arduino/libraries/WiflySerial1/WiflySerial1.cpp: In member function ‘boolean WiflySerial1::openConnection(char*, int, long unsigned int)’:
…Arduino/libraries/WiflySerial1/WiflySerial1.cpp:438: error: ‘itoa’ was not declared in this scope

This error occurs when compiling for Due.
Not for Mega 2560, and I test the last modifications with a Mega… :roll_eyes:
A search in the forum and I get the solution: just add

#include <itoa.h>

in file WiflySerial1.h
This line don’t hurt when compiling for Mega 2560 so I shall add it to next version

Yes, that was the problem, now it works.

Thanks again.

I had problem with this code ,it does not work on arduino due
#include <WiflySerial1.h>

/-----( Import needed libraries )-----/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
/-----( Declare Constants and Pin Numbers )-----/
#define CE_PIN 9
#define CSN_PIN 10
#define JOYSTICK_X A0
#define JOYSTICK_Y A1

// NOTE: the “LL” at the end of the constant is “LongLong” type
const uint64_t pipe = 0xE8E8F0F0E1LL; // Define the transmit pipe

/-----( Declare objects )-----/
RF24 radio(CE_PIN, CSN_PIN); // Create a Radio
/-----( Declare Variables )-----/
int joystick[2]; // 2 element array holding Joystick readings

void setup() /****** SETUP: RUNS ONCE ******/
}//–(end setup )—

void loop() /****** LOOP: RUNS CONSTANTLY ******/
joystick[0] = analogRead(JOYSTICK_X);
joystick[1] = analogRead(JOYSTICK_Y);

radio.write( joystick, sizeof(joystick) );

}//–(end main loop )—

/-----( Declare User-written Functions )-----/

//( THE END )**