Please help arduino uno + wifly: turn a led remotely.

Hi, This is my first question to the experts. I started with a difficult challenge for me (I am just starting in this arduino world!); I am trying to turn a led on/of remotely -via web browser-using WiFly RN-XV module (no shield) connected to my arduino uno. I successfuly created a network with the module and my Mac (ssid, IP...). The problem is when I tried the sketch.I use the code below (I got it from the internet). I tried new libraries (WiFlyHQ) and got "compiling errors" Can any one help me?

Thanks in advance!

include "WiFly.h"

include "Credentials.h"

int ledPin = 9;

Server server(80);

void setup() { WiFly.begin();

if (!WiFly.join(ssid, passphrase)) { while (1) { // Hang on failure. } }

pinMode(ledPin,OUTPUT); server.begin(); // begin the server

Serial.begin(9600); Serial.println(" ** Beginning Server ** "); Serial.print("IP: "); Serial.println(WiFly.ip());


Serial.println("Ready for commands"); digitalWrite(ledPin, HIGH); }

void loop() {

Client client = server.available();

//check if their is a connection if (client) { // an http request ends with a blank line boolean current_line_is_blank = true;

while (client.connected()) { // Checks if connection is still available if (client.available()) { char c =;

if(c == '$') { Serial.print("Client says: "); Serial.print(c); // Read the character after the $ c =; switch(c) { case '1': digitalWrite(ledPin, LOW); Serial.println("OFF"); break; case '2': digitalWrite(ledPin, HIGH); Serial.println("ON"); break; } // Stop reading the packet if there is a comment? # if(c == '#') { Serial.println(c); break; } } } // give the web browser time to receive the data delay(10); } } }

You forgot the code tags so we maybe don't see the complete code but it's obvious that the code doesn't compile because you're using variables (p.e. ssid, passphrase, etc.) that are nowhere defined in your sketch.

What hardware are you using? Please post a link to the hardware and to the used library (there is more than one library called WiFly).

Hi pylon, thank you for yor answer. I am sorry, I did not include that info. here it is:

Here is the HW I am using: The library:

(The code was written for the HW:

Again, thank you!

The RN-XV uses a UART to communicate with the Arduino while the WiFly shield has a SPI-UART on the board. You cannot use software written for the later on the former board. My experience with the RN-XV is that it works as a charm on the hardware serial but I never got it to run reliably with a SoftwareSerial emulation on other pins (at least not with a reasonable baud rate).

So either do the debugging over a SoftwareSerial (or better a AltSoftSerial) or get a Mega2560 with 4 hardware serial interfaces.