- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I am trying to connect Intel Edison to WiFi by creating hotspot from my mobile. I am able to connect to WiFi but even after I am switching off my hotspot WiFi.status() is showing that I am connected to WiFi. Please help me out
The code I used is as follows and I am attaching the Libraries.
# include
# include
char ssid[] = "mynetwork"; // your network SSID (name)
char key[] = "12345678"; // your network key
int status = WL_IDLE_STATUS; // the Wifi radio's status
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);
// attempt to connect to Wifi network:
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA network, SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid, key);
// wait 10 seconds for connection:
delay(10000);
}
// once you are connected :
Serial.print("You're connected to the network");
}
void loop() {
//check the network status connection once every 10 seconds:
delay(10000);
Serial.println(WiFi.status());
}
- Tags:
- WiFi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Venkatesh_Are,
If you check the WiFI library, you will notice that the WIFI.status() method only returns the last status saved:
uint8_t WiFiClass::status()
{
return _status;
}
In your code, the status is updated when you call the WIFI.begin() method. In that moment the Edison is connected to the network. That status is not updated anymore so, even though the network is not available and the Edison is actually without connection, the status saved hasn't changed and consequently, when you call the WIFI.status() method you get the status that the Edison is still connected.
Your code is not wrong, that's simply the way the WIFI library works with Edison. The libraries you attached are not the ones used by Edison, those libraries are the ones used by the Arduino boards. If you are using the Arduino IDE 1.6.0 version you can check the WIFI libraries for Edison in the following directory: C:\...\arduino-1.6.0+Intel\hardware\intel\i686\libraries\WiFi
I recommend you to check the WIFI status using another way, for example checking if you still have an IP address. The method WIFI.BSSID() might be helpful too. Anyhow, the description of each method is in the WIFI library, check them and choose the most appropriate for your application.
Regards,
Diego
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Venkatesh_Are,
If you check the WiFI library, you will notice that the WIFI.status() method only returns the last status saved:
uint8_t WiFiClass::status()
{
return _status;
}
In your code, the status is updated when you call the WIFI.begin() method. In that moment the Edison is connected to the network. That status is not updated anymore so, even though the network is not available and the Edison is actually without connection, the status saved hasn't changed and consequently, when you call the WIFI.status() method you get the status that the Edison is still connected.
Your code is not wrong, that's simply the way the WIFI library works with Edison. The libraries you attached are not the ones used by Edison, those libraries are the ones used by the Arduino boards. If you are using the Arduino IDE 1.6.0 version you can check the WIFI libraries for Edison in the following directory: C:\...\arduino-1.6.0+Intel\hardware\intel\i686\libraries\WiFi
I recommend you to check the WIFI status using another way, for example checking if you still have an IP address. The method WIFI.BSSID() might be helpful too. Anyhow, the description of each method is in the WIFI library, check them and choose the most appropriate for your application.
Regards,
Diego

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page