티스토리 뷰

SWDesk/Firmware

ESP8266 AP mode Test

inhae 2021. 12. 5. 09:52

Reference Link

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>

#define WIFI_MAX_SIZE 100

const char* ssid = "BSSID001";
const char* ssidPW = "BSSIDPW!";

ESP8266WebServer server(80); 
String wifiList[WIFI_MAX_SIZE];


void setup(){

  Serial.begin(9600);
  ScanWiFiList();

  WiFi.softAP(ssid, ssidPW);
  IPAddress myIP = WiFi.softAPIP();

  Serial.println("\n=============================================");
  Serial.print("AP IP address: "); 
  Serial.println(myIP); 
  server.on("/", handleRoot); server.begin(); 
  Serial.println("HTTP server started"); 
  
}

void loop(){
  server.handleClient();
}


void ScanWiFiList() { 
  int numberOfNetworks = WiFi.scanNetworks(); 
  for(int i =0; i<numberOfNetworks; i++){ 
    wifiList[i] = WiFi.SSID(i);
    Serial.println(wifiList[i]); 
  } 
}

void handleRoot() { 
  server.send(200, "text/html", prepareSelectWifiListPage()); 
}

String prepareSelectWifiListPage(){ 
  String strList ="<ul>"; 
}

반응형

'SWDesk > Firmware' 카테고리의 다른 글

Control Code for 7-Segment  (0) 2022.02.25
ESP8266 APmode 테스트  (1) 2022.02.12
Nano 33 IoT Firmware Update  (0) 2021.12.04
RTC로부터 시각 정보를 String으로 변환  (0) 2021.11.30
Nano 33 Multiple Peripheral  (0) 2021.11.28