mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Add WEP/WAP connection example and server example
This commit is contained in:
@ -85,12 +85,15 @@ void printCurrNet()
|
||||
|
||||
void scanNetworks()
|
||||
{
|
||||
Serial.println("** Scan Networks **");
|
||||
byte numSsid = WiFi.scanNetworks();
|
||||
if (numSsid > MAX_NUM_SSID) numSsid = MAX_NUM_SSID;
|
||||
Serial.print("SSID List:");
|
||||
Serial.println(numSsid, 10);
|
||||
for (int i = 0; i<numSsid; ++i)
|
||||
{
|
||||
Serial.print(i,10);
|
||||
Serial.print(") Network: ");
|
||||
Serial.println(WiFi.SSID(i));
|
||||
}
|
||||
}
|
||||
@ -119,9 +122,9 @@ void setup()
|
||||
|
||||
delay(3000);
|
||||
|
||||
int _status = startWiFiWep();
|
||||
startWiFiWep();
|
||||
|
||||
if ( _status == WL_CONNECTED)
|
||||
if ( status == WL_CONNECTED)
|
||||
{
|
||||
Serial.println("Wifi Connected!");
|
||||
|
||||
@ -130,24 +133,21 @@ void setup()
|
||||
printCurrNet();
|
||||
|
||||
scanNetworks();
|
||||
/*
|
||||
|
||||
Serial.println("Starting server...");
|
||||
server.begin();
|
||||
delay(1000);
|
||||
*/
|
||||
delay(1000);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
/*
|
||||
static uint8_t count = 0;
|
||||
Serial.println("Retry connect...");
|
||||
status = WiFi.begin(ssid);
|
||||
|
||||
if (status == WL_CONNECTED)
|
||||
{
|
||||
byte status = 0;
|
||||
Client client = server.available(&status);
|
||||
byte _status = 0;
|
||||
Client client = server.available(&_status);
|
||||
if (client) {
|
||||
//Serial.print("Status: ");
|
||||
//Serial.println(status, 16);
|
||||
@ -160,13 +160,12 @@ void loop()
|
||||
if (idx>0)
|
||||
{
|
||||
dataBuf[idx]=0;
|
||||
//Serial.println((char*)&dataBuf[0]);
|
||||
Serial.println((char*)&dataBuf[0]);
|
||||
server.write((char*)&dataBuf[0]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user