Arduino WiFly connects to server but doesn't send
I have a WiFly shield (https://www.sparkfun.com/products/9954) connected to an arduino Mega 2560.
I try to connect to a server I made and I succeed (or so the arduino says) but no connection or data is received on the server side.
I tested the server with telnet and it works.
Here's my arduino code:
char passphrase[] = "passphrase";
char ssid[] = "";
uint8_t server[] = { 192, 168, 0, 4 };
WiFlyClient client(server, 9050);
int val = 0;
void setup()
{
Serial.begin(9600);
Serial.println("Serial begun!");
WiFly.begin();
Serial.println("WiFly begun! :D");
if (!WiFly.join(ssid, passphrase)) {
Serial.println("Association failed.");
while (1) {
// Hang on failure.
}
}
Serial.println("connecting...");
if (client.connect()) {
Serial.println("connected");
client.println("hello");
}
} else {
Serial.println("connection failed");
}
}
The serial prints everything ok.
Any ideas what's going on?
I have a WiFly shield (https://www.sparkfun.com/products/9954) connected to an arduino Mega 2560.
I try to connect to a server I made and I succeed (or so the arduino says) but no connection or data is received on the server side.
I tested the server with telnet and it works.
Here's my arduino code:
char passphrase[] = "passphrase";
char ssid[] = "";
uint8_t server[] = { 192, 168, 0, 4 };
WiFlyClient client(server, 9050);
int val = 0;
void setup()
{
Serial.begin(9600);
Serial.println("Serial begun!");
WiFly.begin();
Serial.println("WiFly begun! :D");
if (!WiFly.join(ssid, passphrase)) {
Serial.println("Association failed.");
while (1) {
// Hang on failure.
}
}
Serial.println("connecting...");
if (client.connect()) {
Serial.println("connected");
client.println("hello");
}
} else {
Serial.println("connection failed");
}
}
The serial prints everything ok.
Any ideas what's going on?
No comments:
Post a Comment