SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By Luissoares
#128341
Hi,

I a little bit new to this...

I was using the Ethernet library from Arduinos core libraries.

But right now i wanted to use the HTTPclient from http://interactive-matter.eu/how-to/ard ... t-library/ interactive matter.

But in the last updates of this library, they started using the WiFly library as way to control the ethernet and wireless hardware of arduino.

i wanted to know, how should i proceed to substitute the actual Ethernet library for the Wifly library.
Is it transparent? What should i be expecting and what cares should i take?

Cheers
By jaycollett
#130388
Well, I updated the firmware on my shield per the manufacturer (to fix the RTC bug) and now the library refuses to connect to a webserver. I was able to connect before using the example client sketch, now it just sits on "connecting..." and the PIO4 led flashes fast (in command mode). I think the commands have changed for opening a connection but I can't seem to verify....

Any help is much appreciated...
By k_san88
#130402
On a related note, is it possible to get an update to the Alpha 2 library? Is it likely that we might get to beta sometime? Thanks for all the efforts to this end so far. Most appreciated.
By jaycollett
#130424
Guys, since I'm having issues with the latest firmware and the WiFly library alpha 2, I forked genetikayos's alpha 2 library and added new functions and will have support for firmware versions 2.26 and above. Since there hasn't been any activity on the library in a few months, I figured this would be helpful for some.

The 2.26 firmware fixes some major bugs with the module and is highly recommended you upgrade, unfortunately this will break the client and server portions of the library. I'm actively working on a fix and will let folks know when it's working.

Some highlights of what's been added:

int getSignalStrength()
Will return the last reported signal from the module as an int.

long getTime()
Will return the time in Unix (Epoch) format from the NTP server. In UTC time.

long getUpTime()
Will return the time in seconds since the last reboot/power up.

https://github.com/jaycollett/WiFly-Shield

UPDATE: I have now updated the code at github to work with the client side parts of the library when using firmware 2.26 or later. I'll update the post again once I have the server side parts updated.
By Veilkrand
#130760
Hi, somebody could indicate me how to reboot the wifly using the WiFly library?

I implemented some client to get a simple html from a remote webserver every 1 minute, but after 1 hour or less it hangs on client.connect() and green led blink fast (No IP?). So I thought I could just reboot the shield every 10 minutes or so.

Thanks!
By k_san88
#130773
jaycollett wrote:I'll update the post again once I have the server side parts updated.
Hi Jay, did you have a chance to look into the server side? Would be wonderful if you could kindly share. Thank you very much!
By CapacitiveMind
#130807
For those interested in AdHoc mode for your WiFly adapter, and still want to use the WiFly Library, I've hacked together the function below to make it easier to setup.
Code: Select all
void WiFlyDevice::beginAdhoc() {
  /*
    Create and AdHoc network with the WiFly Shield.
   */
   
  DEBUG_LOG(1, "Entered WiFlyDevice::beginAdhoc()");
  
  uart.begin();
  reboot(); // Reboot to get device into known state
  requireFlowControl();
  enterCommandMode();

  // Turn on Adhoc Mode
  sendCommand("set wlan join 4");
  // Set SSID of Adhoc Network
  sendCommand("set wlan ssid MY_SSID");
  // Set Channel for Adhoc Network
  sendCommand("set wlan chan 1");
  // Set IP for Adhoc Network
  sendCommand("set ip address 169.254.1.1");
  sendCommand("set ip netmask 255.255.0.0");
  // Turn off DHCP
  sendCommand("set ip dhcp 0");
  // Set server port
  sendCommand("set ip localport ", true);
  uart.print(serverPort);
  sendCommand("");

  // Turn off remote connect message
  sendCommand("set comm remote 0");
  
  sendCommand("save", false, "Storing in config");
  //Ensures sucessful reboot. See requireFlowControl for more info.
  sendCommand("get uart", false, "Flow=0x1");
  reboot();
  
  //After rebooting, your AdHoc network will be available.
}
Run this function in the setup() routine and you'll have an adhoc network ready to go.

It takes the WiFly around a minute to issue an IP to the connecting device, but once the address is issued it works great.
By jcrouchley
#131321
Hi Jay,
Just got a WiFly shield - and when I update the firmware the latest one it will give is 2.23 !! I cannot find/get 2.26.

Also your library appears to have lost the WiFly.Configure(..) method along the way (your commit of 2011-07-19 19:21:32) - was this intentional?

Best regards
John.
By jaycollett
#131347
jcrouchley wrote:Hi Jay,
Just got a WiFly shield - and when I update the firmware the latest one it will give is 2.23 !! I cannot find/get 2.26.

Also your library appears to have lost the WiFly.Configure(..) method along the way (your commit of 2011-07-19 19:21:32) - was this intentional?

Best regards
John.
John:

The guys over at RovingNetworks gave me the image name to use, just issue this command once you are connected to the internet on the WiFly:

ftp u wifly-226.img

Then power off and power on the Wifly, you'll have the new firmware. The old one is actually still on the WiFly, you can use the file commands on the WiFly to remove the old one.

Not sure what you mean about the Configure() being gone? Can you elaborate? There should only be additions and a few modifications to the Alpha 2 version I forked off of. I'm still working on the library, I've got about a dozen tweaks, working directly with RovingNetworks on getting this as solid as I can. The project I"m using it for really needs to have a reliable connection (for a hobby project). :)
By libby9284
#131574
Hello,

I'm a bit new to the arduino environment and the WiFly board. I've been trying to modify the WiFly library to support pinging but can't get the arduino environment to recognize my change. Below is a snippet showing what I changed. After I made my changes I made sure the newest files were in the proper library folder and restarted the arduino environment, but when I try to compile I get this error: "'class WiFlyDevice' has no member named 'connectionActive'". Is there a step I'm missing?

Thanks.

Code:
WiFly.h:
class WiFlyDevice {
public:
WiFlyDevice(SpiUartDevice& theUart);
// new function
boolean connectionActive();
...
private:
...
}
WiFly.cpp :
boolean WiFlyDevice::connectionActive()
{
boolean testConn = false;
enterCommandMode();
sendCommand("ping g");
...
}
By fableman
#133245
Using alpha2.

I got the server to show my temperatures.
I can send input to the arduino from the web and all. like ?SHOWFREEMEM ?RESTART and other functions i included.

But.... The webserver simply stop responding at all after 2-3 days, got a feeling the error is in the

Client client = server.available();

if (client) {
// an http request ends with a blank line
boolean current_line_is_blank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();


Its like it stop noticed that a client connect.

Please help or is there any other version I can use/try?

Nice libraries but kinda come to an end when I can't use them longer then 2-3 days uptime.
By k_san88
#133248
I fully agree. When I bought this shield I did not realize that there would be no software support from SparkFun. No offense to the creator of the current library and to further update coders. Thanks to their efforts the product is useable to a certain degree but I am sort of puzzled as to how SparkFun can sell something like this that requires software libraries to operate and then not invest in making them available and stable.
By fableman
#133322
Hi,

Have any work been done on server.cpp ?

This part stop working after a few days. and the code don't see an active http request (client connect)

If there is new and better code to handle this I would be very greatfull to try it out.
Code: Select all
Client& Server::available() {
  /*
   */

  // TODO: Ensure no active non-server client connection.

  if (!WiFly.serverConnectionActive) {
    activeClient._port = 0;
  }

  // TODO: Ensure begin() has been called.

  // Return active server connection if present
  if (!activeClient) {
    // TODO: Handle this better
    if (WiFly.uart.available() >= strlen(TOKEN_MATCH_OPEN)) {
      if (WiFly.responseMatched(TOKEN_MATCH_OPEN)) {
	// The following values indicate that the connection was
	// created when acting as a server.

	// TODO: Work out why this alternate instantiation code doesn't work:
	//activeClient = Client((uint8_t*) NULL, _port);

	activeClient._port = _port;
	activeClient._domain = NULL;
	activeClient._ip = NULL;

	activeClient.connect();
	WiFly.serverConnectionActive = true;
      } else {
	// Ignore other feedback from the WiFly module.
	// TODO: Should we check we're not ditching a connect accidentally?
	//WiFly.skipRemainderOfResponse();
	WiFly.uart.flush();
      }