I'm using arduino devices since 2 months ago and I like it. For the first time, it's really plug and play, and very simple for getting started. Nice job!
unfortunately, today, I'm experimenting troubles...
I use arduino mega 2560 + Ethernet shield, and I have developped very fast a UDP serversocket, which work very well...
So I tried to replace the Ethernet shield with a WiFly device (this one: WiFly Shield - WRL-09367 - SparkFun Electronics)
The problem is during the WiFly.begin(); which froze the system.
Here is my code
#include <SPI.h>
#include <WiFly.h>
#include "Credentials.h"
WiFlyServer server(80);
void setup() {
Serial.begin(9600);
Serial.print("Initialisation...");
WiFly.setUart(&Serial);
WiFly.begin();
Serial.println("WiFly.begin finished.");
if (!WiFly.join(ssid)) {
while (1) {
// Hang on failure.
Serial.println("Error connection");
}
}
Serial.println("Connection OK.");
Serial.print("IP: ");
Serial.println(WiFly.ip());
server.begin();
}
The result is (on the serial monitor):
Initialisation...$$$
WiFly uses the serial interface for communication with the Arduino. Because of that you cannot use the hardware serial interface ("Serial") for debugging, if you wanna debug, use SoftwareSerial and some kind of USB2Serial adapter (p.e. USB2Serial Light, Foca, FTDI cable, etc.) to attach to your PC.
I use a belkin router and i have configured no security and ssid:arduino
I read somewhere that we must use:
No security: WiFly.join(“ssid”)
WPA Mode : WiFly.join(“ssid”, “passphrase”)
WEP Mode: WiFly.join(“ssid”, “passphrase”, WEP_MODE)
How did you connect the WiFly (are you using the shield or the RN-XV?) to the Arduino? Doesn't it have a switch to change from PC/USB to Arduino connection? Have you tried setting it up with commands from the PC directly?
If it is, you need other software because this does not use the UART of the Arduino for the connection but a separate SPI2UART chip, so the software has to use the SPI interface. They have an alpha level library in their forum: WiFly Shield code library alpha 2 release - SparkFun Electronics Forum.
The positive effect is that you can use the Serial for debugging and other stuff again.