4

UPDATE: I pinpointed where the problem is coming from. To avoid any complication, I'm using ScanNetwork example, so I don't even have to put in SSID. The code stops functioning on the board as soon as it hits WiFi.status(). I have a Serial.println before and after it tries to get a WiFi.status(), the serial.println after wasn't performed, and of course, I'm still not connected.

I've downloaded fresh copy of the code, and the situation remains the same. I've really run out of idea....


I'm using the official arduino wifi shield, and I have the following code:

status = WiFi.begin([ssid],[pass]);
Serial.println(status);

Status is neither WL_CONNECTED nor WL_IDLE_STATUS, which are the two possible responses outlined in the official reference http://arduino.cc/en/Reference/WiFiBegin

Status is the number 4. and of course, I couldn't connect to wifi. What is this????

I've pressed the reset button a million times, is there a more powerful factory restore button?

William Sham
  • 12,849
  • 11
  • 50
  • 67

2 Answers2

4

enter image description here

I've figured it out. Apparently, there's a jumper, that when you put it in, it'll kick the shield into a DFU-mode that enables reprogramming. And the shield wouldn't be present as a result.

William Sham
  • 12,849
  • 11
  • 50
  • 67
2

According to WiFi.h The return values of the begin() functions (all three of them, one for each security scheme) are ints. It is not stated outright on this function but I believe that just as with the status() function the return type is a wl_status_t. wl_status_t is an enum declared in wl_definitions.h As:

typedef enum {
        WL_NO_SHIELD = 255,
        WL_IDLE_STATUS = 0,
        WL_NO_SSID_AVAIL,
        WL_SCAN_COMPLETED,
        WL_CONNECTED,
        WL_CONNECT_FAILED,
        WL_CONNECTION_LOST,
        WL_DISCONNECTED
} wl_status_t;

So your 4 is WL_CONNECT_FAILED. Probably not surprising to you since, you know, you connection failed.

The hobbiest's debugger, AKA reset button, will only do so much. Printing the status was a good start. Be sure you are using the right flavor of begin() for you security type, you seem to be using the one for WPA. Consider shutting off you router's security completely (if safe to do so in your area), or using a spare router, to test the ability of the shield to communicate at all. Also this may sound obvious but check for a misspelling of the SSID.

NJones
  • 27,139
  • 8
  • 70
  • 88
  • Thanks. Based on your comment, I've pinpoint the problem. The code comes to a complete stop as soon as it hits WiFi.status(), please see update above. – William Sham Dec 07 '12 at 06:59
  • This very-well might be an error on your shield. Try updating the firmware on the shield. [The how-to for that can be found on **this** page of the arduino.cc website.](http://arduino.cc/en/Hacking/WiFiShieldFirmwareUpgrading) – NJones Dec 10 '12 at 05:14
  • I was reading it and got stuck on the part it mentions "Connect the J3 jumper to put the shield in the programming mode" what's a J3 jumper – William Sham Dec 16 '12 at 01:59