unique and exclusive. If users want to reset the MAC address, the uniqueness of the
MAC address should be assured.
2. Set ESP8266 to Station+SoftAP mode.
Wi-Fi_set_opmode(STATIONAP_MODE);
3. Read the MAC addresses of the Station and SoftAP interfaces.
Wi-Fi_get_macaddr(SOFTAP_IF,sofap_mac);
Wi-Fi_get_macaddr(STATION_IF,sta_mac);
4. Set the MAC addresses of the Station and SoftAP interfaces. The setting of MAC
addresses is not stored in the flash, and the setting can only be done when the
corresponding interface is enabled first.
charsofap_mac[6]={0x16,0x34,0x56,0x78,0x90,0xab};
charsta_mac[6]={0x12,0x34,0x56,0x78,0x90,0xab};
Wi-Fi_set_macaddr(SOFTAP_IF,sofap_mac);
Wi-Fi_set_macaddr(STATION_IF,sta_mac);
5. Compile the application program, generate firmware and download it into the ESP8266
module.
6. Power off the module, and change it to operation mode, then power on the module and
run the program.
Result:
ESP8266stationMAC:18:fe:34:97:f7:40
ESP8266soft-APMAC:1a:fe:34:97:f7:40
ESP8266stationnewMAC:12:34:56:78:90:ab
ESP8266soft-APnewMAC:16:34:56:78:90:ab
3.2.7. Scan Nearby APs
1. Set ESP8266 to work in Station mode, or Station+SoftAP mode.
Wi-Fi_set_opmode(STATIONAP_MODE);
2. Scan nearby APs.
If the first parameter of Wi-Fi_station_scan is NULL, all APs around will be scanned; if
certain information including SSID and channel is defined in the first parameter, then that
specific AP info will be returned.
Wi-Fi_station_scan(NULL,scan_done);