Take the 2-minute tour ×
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

I have problems with wi-fi shield example code.

#include <SPI.h>
#include <WiFi.h>

char ssid[] = "*****";          //  your network SSID (name) 
char pass[] = "*****";   // your network password

int status = WL_IDLE_STATUS;
char servername[]="google.com";  // remote server we will connect to

WiFiClient client;

void setup() {
    Serial.begin(9600);
    //disable SD SPI
    pinMode(4, OUTPUT);
    digitalWrite(4, HIGH);

    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");
        // don't do anything else:
        while(true);
        } 
     else {
     Serial.println("Connected to wifi");
     Serial.println("\nStarting connection...");
     // if you get a connection, report back via serial:
     if (client.connect(servername, 80)) {
         Serial.println("connected");
         // Make a HTTP request:
         client.println("GET /search?q=arduino HTTP/1.0");
         client.println();
      }
    }
}

 void loop() {

}

Wifi Shield have connected with internet wifi, but the last printing was "Starting connection..." I can't get to connect to (google.com), why?

Thank you anyway.

share|improve this question

migrated from stackoverflow.com May 8 at 19:16

This question came from our site for professional and enthusiast programmers.

1  
You already posted this (stackoverflow.com/questions/23447841/…); please don't post duplicates. –  Oli Charlesworth May 3 at 17:46
    
insert a Serial.println(status); and which WL_status is returned? Did it actually connect (WL_CONNECTED) or is it some other result? –  Madivad May 13 at 11:18
add comment

1 Answer

I had this problem aswell. The problem was a bug with the official editor of arduino. I fixed this by downgrading the editor to version 1.0.3. (from 1.0.5) You can find a download link for it at the Arduino website.

Hope this helped!
-Kad

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.