mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Moved WiFi driver initialization to default constructor
Moved scanNetworks in the example before wifi connection setup in order to show the list of possible WiFi APs.
This commit is contained in:
@ -28,7 +28,11 @@ IPAddress subnet; // the subnet mask
|
||||
void setup() {
|
||||
// initialize serial:
|
||||
Serial.begin(9600);
|
||||
|
||||
|
||||
// scan for existing networks:
|
||||
Serial.println("Scanning available networks...");
|
||||
scanNetworks();
|
||||
|
||||
// attempt to connect using WEP encryption:
|
||||
Serial.println("Attempting to connect to open network...");
|
||||
status = WiFi.begin(ssid);
|
||||
@ -36,10 +40,6 @@ void setup() {
|
||||
Serial.print("SSID: ");
|
||||
Serial.println(ssid);
|
||||
|
||||
// scan for existing networks:
|
||||
Serial.println("Scanning available networks...");
|
||||
scanNetworks();
|
||||
|
||||
// if you're not connected, stop here:
|
||||
if ( status != WL_CONNECTED) {
|
||||
Serial.println("Couldn't get a wifi connection");
|
||||
|
Reference in New Issue
Block a user