Hello charalamposdoukas,
I have been trying to adapt the arduino code from Ethernet to Wifly. I did that looking at the diferences between Wifly_WebServer example from WiFly Shield code library alpha 2 (source:WiFly Shield code library alpha 2 release - SparkFun Electronics Forum) and WebServer example from Ethernet library.
The result is the following code, but it doesn´t run. It has an error that says: "No matching function for call to 'Client::Client()' ". Can you help me with this please?
Thanks in advance
#include "WiFly.h"
#include "Credentials.h"
Server server(80);
void setup() {
// start the WiFly connection:
WiFly.begin();
if (!WiFly.join(ssid, passphrase)) {
while (1) {
// Hang on failure.
}
}
Serial.begin(9600);
Serial.print("IP: ");
Serial.println(WiFly.ip());
server.begin();
// give the WiFly shield a second to initialize:
delay(1000);
Serial.println("connecting...");
// if you get a connection, report back via serial:
if (client.connect(server, 1234)) {
Serial.println("connected");
}
else {
// if you didn't get a connection to the server:
Serial.println("connection failed");
}
}
void loop() {
Client client = server.available();
//The following code will simply send characters for Terminal input to the server - use it as a test
while (Serial.available() > 0) {
char inChar = Serial.read();
if (client.connected()) {
client.print(inChar);
}
}
// if the server's disconnected, stop the client:
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
// do nothing:
while(true);
}
}
At the credentials sketch tab the code is:
#ifndef __CREDENTIALS_H__
#define __CREDENTIALS_H__
// Wifi parameters
char passphrase[] = "passphrase";//my passphrase
char ssid[] = "Wifly";
#endif