My project is Arduino RC car controlling with android for that i bought Arduino Uno r3 and arduino wifi shield http://arduino.cc/en/Main/ArduinoWiFiShield ,problem is - wifiShield not listening the client and can’t receive datas,I dont know how to solve the problem,and cannot setup conection between devices…( =( =( =(
Arduino Code:
char ssid[] = "***"; // your network SSID (name)
char pass[] = "***"; // your network password
int status = WL_IDLE_STATUS;
WiFiServer server(1991);
//String readString;
boolean alreadyConnected = false; // whether or not the client was connected previously
void setup() {
// initialize serial:
Serial.begin(9600);
Serial.println("Attempting to connect to WPA network...");
Serial.print("SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid, pass);
if ( status != WL_CONNECTED) {
Serial.println("Couldn't get a wifi connection");
while(true);
}
else {
server.begin();
server.status();
Serial.print("Connected to wifi. My address:");
IPAddress myAddress = WiFi.localIP();
IPAddress inetAddress=WiFi.gatewayIP();
Serial.println( myAddress);
Serial.println("Inet: ");
Serial.println(inetAddress);
}
}
void loop() {
// wait for a new client:
WiFiClient client = server.available();
// when the client sends the first byte, say hello:
if (client) {
if (!alreadyConnected) {
// clead out the input buffer:
client.flush();
Serial.println("We have a new client");
client.println("Hello, client!");
alreadyConnected = true;
}
if (client.available() > 0) {
// read the bytes incoming from the client:
char thisChar = client.read();
// echo the bytes back to the client:
server.write(thisChar);
// echo the bytes to the server as well:
Serial.write(thisChar);
}
}
}
I’m a newbie
thanks for your help in advance…