system
December 7, 2012, 4:07am
1
When I'm doing
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
The Arduino programming language Reference, organized into Functions, Variable and Constant, and Structure keywords.
Status is the number 4.
and of course, I couldn't connect to wifi
What???
I've pressed the reset button a million times, is there a more powerful factory restore button?
system
December 7, 2012, 8:28am
2
It would help to see all of your code. The number you're getting may be because of the network you're trying to connect to. If you're trying to connect to a WEP network, using "pass" is not going to work, as you have to provide the hex key to gain access. Again, seeing all of your code would be very helpful.
system
December 7, 2012, 2:39pm
3
What values do WL_CONNECTED and WL_IDLE_STATUS correspond to?
Why are ssid and pass in square brackets in that call?
system
December 7, 2012, 2:57pm
4
PaulS:
What values do WL_CONNECTED and WL_IDLE_STATUS correspond to?
.../WiFi/utility/wl-definitions.h:
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;
Status 4 is WL_CONNECT_FAILED. See .../WiFi/WiFi.cpp
int WiFiClass::begin(char* ssid, const char *passphrase)
{
uint8_t status = WL_IDLE_STATUS;
uint8_t attempts = WL_MAX_ATTEMPT_CONNECTION;
// set passphrase
if (WiFiDrv::wifiSetPassphrase(ssid, strlen(ssid), passphrase, strlen(passphrase))!= WL_FAILURE)
{
do
{
delay(WL_DELAY_START_CONNECTION);
status = WiFiDrv::getConnectionStatus();
}
while ((( status == WL_IDLE_STATUS)||(status == WL_SCAN_COMPLETED))&&(--attempts>0));
}else{
status = WL_CONNECT_FAILED;
}
return status;
}