Hello!
I am connecting my Arduino Uno with a Wifly shield, but i have a problem.
When I do a request ("URLSERVER/request") this is sended without problem. But only the first request.
Example: 192.168.169.3/Hello
When i do a second request, my program is disconnected from the server.
Example: 192.168.169.3/Hello2
Any idea?
#include "WiFly.h"
#include "Credentials.h"
byte server[] = { 192, 168, 169, 3 };
Client client("192.168.169.3", 80);
// the setup routine runs once when you press reset:
void setup() {
Serial.begin(9600);
connectToWiFi();
startClient();
}
void loop() {
if (client.available()) {
char c = client.read();
Serial.print(c);
}
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting...");
client.stop();
}
}
void connectToWiFi() {
Serial.println("Beginning...");
WiFly.begin();
Serial.println("Finished beginning");
(WiFly.join("Tests"));
}
void startClient() {
Serial.println("Connecting...");
if (client.connect()) {
Serial.println("Connected");
Serial.print("IP: ");
Serial.println(WiFly.ip());
} else {
Serial.println("Connection failed");
}
}
EDIT: PROBLEM SOLVED.