sparkfun / wifly-shield Goto Github PK
View Code? Open in Web Editor NEWWiFly Shield -- A shield for the Roving Networks RN-52 WiFly Module.
Home Page: https://www.sparkfun.com/products/9954
License: Other
WiFly Shield -- A shield for the Roving Networks RN-52 WiFly Module.
Home Page: https://www.sparkfun.com/products/9954
License: Other
nothin
Occasionally when calling client.connect() it will hang, rather than returning. If I reset the Arduino (and hence the shield), the next call will usually work. I have not been able to correlate it to a WiFi signal issue or network connectivity problem. This will happen at variable times after the last reset of the Arduino, e.g. after an hour, or sometimes after three days. My use case is a sensor array that posts HTTP data to a remote web site each minute.
I have taken a cursory look at the code to see if there are places with missing timeouts, but haven't found them yet.
I'm using the latest code from the repo.
I may just be missing something completely obvious, but I just don't see any way to specify which pins to use for TX and RX. I tried integrating directly through software serial, but ran into timing/buffer issues. I'm assuming that those issues have been solved in this library, but I don't think I can use it if I can't specify which pins are connected to the wifly module. Is there a reason I don't have to specify the pins or is there some way to specify the pins using this library?
Hi,
This is my code and I cannot get it work; any Help?
String request = "GET /api/emotions/primary/totals HTTP/1.1";
String host = "wefeel.csiro.au";
char msg[128];
int lettercount = 0;
byte server[] = { 54, 84, 79, 112 }; // WeFeel
WiFlyClient client("54.84.79.112", 80);
void setup() {
Serial.begin(9600);
WiFly.begin();
if (!WiFly.join(ssid, passphrase)) {
Serial.println("Association failed.");
while (1) {
// Hang on failure.
}
}
Serial.println("connecting...");
delay(25000);
if (client.connect()) {
char c;
int dataFlag = 0;
int msgIsolator = 0;
Serial.println("connected");
Serial.println(request);
delay(25000);
client.println(request);
client.println("\r\n");
client.println(host);
client.println("\r\n\r\n");
delay(500);
client.print(c);
client.println();
client.flush();
client.read();
} else {
Serial.println("connection failed");
}
}
void loop() {
if (client.available()) {
char c = client.read();
Serial.print(c);
}
if (!client.available()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;;)
;
}
}
Hi,
I tried the fork of the library that is meant to get the WiFly shield working with the Mega here https://github.com/jmr13031/WiFly-Shield (since I can't raise issues over there, I am doing it here).
I have upgraded my Arudino IDE and rewired the pins as suggested here http://mcukits.com/2009/04/06/arduino-ethernet-shield-mega-hack/
But the shield still hangs at when trying to call WiFly.begin();
Basically I couldn't get the forked code to work with IDE 1.02.
But when I downgraded my IDE to "Arduino 022" and got the original code from http://sparkfun.com/Code/wifly/WiFly-20100519-023939.zip , it seems to be working fine. That rules out any hardware issues. (After I changed the pin mappings in spi.h. See my original travels with this stack here http://electronics.stackexchange.com/questions/3273/arduino-mega-and-wifly-shield )
Has anyone been able to successfully get the version of the shield here https://www.sparkfun.com/products/9954 (I believe it my be version 2) working with the Arduino IDE 1?
in SpiUartDevice::available() there is a delay(2) statement causing Serial output to become garbled. Imade a change ready to be committed. If I did it right.
Regards
Nico
WProgram.h needs to be arduino.h in the 1.0 IDE, Needs something like this in _Spi.h ...
And for some reason, the overloads of "write" function are not working....
In file included from C:\arduino-1.0\libraries\WiFly/WiFly.h:4,
from WiFly_WebServer.cpp:9:
C:\arduino-1.0\libraries\WiFly/SpiUart.h:62: error: conflicting return type specified for 'virtual void SpiUartDevice::write(byte)'
C:\arduino-1.0\hardware\arduino\cores\arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)'
In file included from C:\arduino-1.0\libraries\WiFly/WiFly.h:8,
from WiFly_WebServer.cpp:9:
C:\arduino-1.0\libraries\WiFly/Client.h:21: error: conflicting return type specified for 'virtual void Client::write(byte)'
C:\arduino-1.0\hardware\arduino\cores\arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)'
C:\arduino-1.0\libraries\WiFly/Client.h:23: error: conflicting return type specified for 'virtual void Client::write(const uint8_t_, size_t)'
C:\arduino-1.0\hardware\arduino\cores\arduino/Print.h:50: error: overriding 'virtual size_t Print::write(const uint8_t_, size_t)'
http://arduino.cc/en/Guide/ArduinoWiFiShield
is the Sparkfun WiFly Shield useable / ready for the ArduinoWifi library?
I encountered an issue this week where softSerial (based on newSoftSerial) does not work in a project that also uses SpiSerial. The order of the include files makes a difference, and both seem to work if softserial.h is included first.
Line 22 in WiFlyDevice.cpp:
unsigned int timeOutTarget; // in milliseconds
needs to be changed to an unsigned long:
unsigned long timeOutTarget; // in milliseconds
otherwise it will wrap in minutes instead of days. This makes findInResponse really unreliable.
I tried to change the baudrate from 9600 to 38400 or 115200 in https://github.com/sparkfun/WiFly-Shield/blob/master/SpiUart.h#L49 but nothing happens - the shield shows no reaction and I'm not able to connect to any wifi network.
To handle this issue I have updated the firmware from the wifly to 2.36 โฆ (I'm using an Arduino SMD R2) but still nothing happens.
source: https://forum.sparkfun.com/viewtopic.php?p=146740#p146740
The high speed example in the newest code (as of June 28, 2012) doesn't work for me because it doesn't seem to set the baud rate for the SpiUart - it only sets the baud rate for the WiFly. To overcome this, I made the following change to SpiUart.h
#define BAUD_RATE_DEFAULT 115200 // WiFly default baudrate
Several methods in WiFlyDevice need timeouts so, instead of hanging on error, we return to the caller.
I have a new timeouts branch in my fork that is a first stab at it. The code is tested and does at least deal more robustly on a failed associate to the access point.
First I got this...
SpiUart.cpp:240:1: error: unterminated #14
Which I was able to fix with an #endif
on line 266
, but now I'm getting this...
WiFlyClient.cpp:41: error: 'Client' has not been declared
WiFly/WiFlyClient.cpp: In function 'size_t write(byte)':
WiFlyClient.cpp:47: error: '_WiFly' was not declared in this scope
WiFlyClient.cpp: At global scope:
WiFlyClient.cpp:54: error: 'Client' has not been declared
WiFlyClient.cpp: In function 'size_t write(const char*)':
WiFlyClient.cpp:60: error: '_WiFly' was not declared in this scope
WiFlyClient.cpp: At global scope:
WiFlyClient.cpp:67: error: 'Client' has not been declared
WiFlyClient.cpp: In function 'size_t write(const uint8_t*, size_t)':
WiFlyClient.cpp:73: error: '_WiFly' was not declared in this scope
WiFlyClient.cpp: At global scope:
WiFlyClient.cpp:79: error: expected constructor, destructor, or type conversion before '.' token
WiFlyClient.cpp:82: error: expected unqualified-id before 'if'
WiFlyClient.cpp:88: error: expected constructor, destructor, or type conversion before '.' token
WiFlyClient.cpp:90: error: expected unqualified-id before 'if'
WiFlyClient.cpp:93: error: expected unqualified-id before 'else'
It is a simple fix to get it working with latest firmware.
Perhaps this should be handled in a better way or could you have different branches for different firmwares?
@@ -158,7 +158,7 @@ boolean WiFlyDevice::enterCommandMode(boolean isAfterBoot) {
// TODO: Find alternate approach or only use this method after a (re)boot?
uart->println(F("ver"));
- if (findInResponse("\r\nWiFly Ver", 1000)) {
+ if (findInResponse("\r\nwifly-GSX Ver", 1000)) {
// TODO: Flush or leave remainder of output?
// flush!! Why would want the remainder for every time we go into command mode?
uart->flush();
Feel free to reject this isssue. It's just my idea on how to more robustly handle errors from commands.
In a nutshell, it seems this library is very similar to Expect. We are basically issuing commands and then pattern matching to find a response.
One of the features that Expect supports is providing a list of patterns that it can search for and what action it should take if any pattern in the list is found,
How I would suggest implementing that feature in WiFly-Shield would be modifying the "toMatch" argument of findInResponse() to be:
int findInResponse(char **toMatch, ...
You would provide the function with a list of matches it would look for. If it finds a match to an item within the list before the timeout expires, the function would return that matches offset in the provided list. If the timeout expires, the function would return -1.
I can't seem to use multiple "Clients." Whenever I declare a second client, the device resets. If I try to set the old instantiation to a new connection, I get a compiler error.
Dear,
I have used this library in conjunction with the SparkFun module (rn-171/Roving Networks) in some projects that I developed, but in two other modules that I purchased recently, I upgraded the firmware to version (WiFly-EZX.img / 2:38 .3) and with this using the example of the library (WiFly_PachubeClient) can no longer update the information on the website of Cosm (Pachube), the response back from the server is (Bad 400), it is interesting that the same code used in another module with the firmware version works perfectly 2:32.
Could anyone tell me how to solve the problem?
Thank you in advance!
Setting
#define DEBUG_LEVEL 1
results in this compile error for every location where a variable is passed as second parameter to DEBUG_LOG():
C:\Users\Jonas\Desktop\arduino-1.0.4\libraries\WiFly\WiFlyDevice.cpp:51: error: initializer fails to determine size of '__c'
Hi all,
I'm attempting to modify the wonderful Webduino library to support the WiFly. It's pretty straightforward since the WiFly lib's client-server classes are api-compatible with the Ethernet library, which Webduino is designed around.
However, when the server process loop attempts to assign server.available() to a client variable:
client = server.available();
I'm getting:
WiFlyClient.h:14: error: non-static reference member 'WiFlyDevice& WiFlyClient::_WiFly', can't use default assignment operator
I'm not sure why this is happening. I've tried all kinds of things to fix it to no avail. Any insights?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.