i have a wifly shield with the rn-131c module on it and the firmware is updated to 4.00.
i have tried all the examples in the wifly library for arduino 1.0 and none of the web client/server codes work.
i searched online and found a simpler code at http://marioboehmer.blogspot.com/2011/0 … duino.html. with this code i can connect to my network and get assigned an ip address of 10.0.0.7.
the problem is that when i run any browser on my computer and go to the address of the wifly, the webpage goes blank and just sits there spinning saying “waiting for 10.0.0.7”. the wifly itself goes from a slow blinking green before i enter the address to a solid on green after i enter the address.
i went into the code and put a serial print right after it reads char c to see what it was reading and this is what i got.
"GET / HTTP/1.1
Host: 10.0.0.7
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;r2)c/01io1
cte/lpcoxllpcixq./=8cpaa:-,q5ApEd:z feocnk-v"
according to the code it is looking for a “\n” but i dont see anything like that so now i know thats where it is hanging in the code.
what is going on? im not sure from this point if it is the browser, the code, the wifly, or the wireless router im using. what do i need to do to correct the problem. any suggestions ?
okay so i have made some more progress at determining the problem. i know now that the problem is that the http get request from the browser is only partial being recieved.
when i use this code
#include "WiFly.h"
Server server(80);
void setup() {
Serial.begin(9600);
SpiSerial.begin();
//exit CMD mode if not already done
SpiSerial.println("");
SpiSerial.println("exit");
delay(1000);
//set into CMD mode
SpiSerial.print("$$");
delay(1000);
//set authorization level
SpiSerial.println("set w a 0");
delay(1000);
//set passphrase
// SpiSerial.println("set w p password");
// delay(1000);
//set localport
SpiSerial.println("set i l 80");
delay(1000);
//disable *HELLO* default message on connect
SpiSerial.println("set comm remote 0");
delay(1000);
//join wifi network <ssid>
SpiSerial.println("join Wifly");
delay(5000);
//exit CMD mode
SpiSerial.println("exit");
delay(1000);
}
void loop() {
listenForClients();
}
void listenForClients() {
// listen for incoming clients
Client client = server.available();
if (client) {
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.print(c);
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();
client.print("Hello World");
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
}
else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
}
}
i get this as a http get request from firefox 11
GET / HTTP/1.1
Host: 10.0.0.7
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64;r2)c/01io1
cte/lpcoxllpcoxq./=8cpaa:-,q5ApEd:z feocnk-v
this from IE 9
GET / HTTP/1.1
Accept: text/html, application/xhtml+xml, /
Accept-Language:eSU-n ia0oalME0WoN6 W dt0
eEogg,ftHt00
ncne-v
and this from chrome 26.0.1410.64 m
GET / HTTP/1.1
Host: 10.0.0.7
Connection: keep-alive
Accept: text/html,application/xtx,ltnl=,;0
eg:ol.(ds ;O)pWi53(Mlec)r/.46Sr31Apni ietd
c-ggeS;.
eCs:O5,fq7q3
for the firefox request it is good up until the WOW64; part then it turns to random text. i do not have a clue what is causing this. i have played around with daelays throught the code and they just change the length of random text at the end. this is causing the code to hang while it waits for “\n” (newline).
i can run telnet and hit enter twice and the code will run perfectly so that proves it is hanging waiting for the newline in the request and also when i exclude the ```
c == ‘\n’ &&