WiFly Shield code library alpha 2 release

For the discussion of Arduino related topics.

Moderator: phalanx

Re: WiFly Shield code library alpha 2 release

Postby roadfun » Tue May 03, 2011 4:42 pm

I posted a solution to space in the SSID name on another thread http://forum.sparkfun.com/viewtopic.php?f=32&t=28163&p=126503#p126503
roadfun
 
Posts: 12
Joined: Sat Apr 30, 2011 1:30 pm

Re: WiFly Shield code library alpha 2 release

Postby Luissoares » Mon Jun 06, 2011 5:43 am

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/arduino-http-client-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
Luissoares
 
Posts: 1
Joined: Mon Jun 06, 2011 5:36 am

Re: WiFly Shield code library alpha 2 release

Postby jaycollett » Mon Jul 18, 2011 8:32 pm

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...
jaycollett
 
Posts: 11
Joined: Thu Aug 27, 2009 6:48 am

Re: WiFly Shield code library alpha 2 release

Postby k_san88 » Tue Jul 19, 2011 3:23 am

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.
k_san88
 
Posts: 9
Joined: Tue Jul 19, 2011 3:14 am

Re: WiFly Shield code library alpha 2 release

Postby jaycollett » Tue Jul 19, 2011 12:45 pm

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.
jaycollett
 
Posts: 11
Joined: Thu Aug 27, 2009 6:48 am

Re: WiFly Shield code library alpha 2 release

Postby k_san88 » Wed Jul 20, 2011 12:41 am

Jay, this is wonderful!!! Thank you so very much for your contribution. Most appreciated.
k_san88
 
Posts: 9
Joined: Tue Jul 19, 2011 3:14 am

Re: WiFly Shield code library alpha 2 release

Postby Veilkrand » Tue Jul 26, 2011 6:58 am

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!
Veilkrand
 
Posts: 2
Joined: Tue Jul 26, 2011 6:51 am

Re: WiFly Shield code library alpha 2 release

Postby k_san88 » Tue Jul 26, 2011 11:22 am

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!
k_san88
 
Posts: 9
Joined: Tue Jul 19, 2011 3:14 am

Re: WiFly Shield code library alpha 2 release

Postby CapacitiveMind » Tue Jul 26, 2011 7:47 pm

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.
CapacitiveMind
 
Posts: 12
Joined: Tue Jul 26, 2011 7:37 pm
Location: Florida

Re: WiFly Shield code library alpha 2 release

Postby jcrouchley » Thu Aug 04, 2011 6:33 am

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.
jcrouchley
 
Posts: 1
Joined: Thu Aug 04, 2011 6:26 am

Re: WiFly Shield code library alpha 2 release

Postby jaycollett » Thu Aug 04, 2011 4:02 pm

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). :)
jaycollett
 
Posts: 11
Joined: Thu Aug 27, 2009 6:48 am

Re: WiFly Shield code library alpha 2 release

Postby libby9284 » Tue Aug 09, 2011 2:10 pm

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");
...
}
libby9284
 
Posts: 1
Joined: Tue Aug 09, 2011 1:37 pm

Re: WiFly Shield code library alpha 2 release

Postby fableman » Mon Sep 12, 2011 2:59 pm

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.
fableman
 
Posts: 8
Joined: Mon Sep 12, 2011 2:44 pm

Re: WiFly Shield code library alpha 2 release

Postby k_san88 » Mon Sep 12, 2011 5:26 pm

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.
k_san88
 
Posts: 9
Joined: Tue Jul 19, 2011 3:14 am

Re: WiFly Shield code library alpha 2 release

Postby fableman » Wed Sep 14, 2011 1:42 am

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();
      }
fableman
 
Posts: 8
Joined: Mon Sep 12, 2011 2:44 pm

PreviousNext

Return to Arduino

Who is online

Users browsing this forum: No registered users and 3 guests