ESP8266学习笔记3:建立自定义的softAP

来源:互联网 发布:淘宝客服外包怎么样 编辑:程序博客网 时间:2024/05/29 15:32

我整理了从2015年至今关于ESP8266的学习笔记,梳理出来了开发环境、基础功能、进阶学习三大部分,方便自己和他人。可点此查看,欢迎交流。

刚才在乐鑫官网看到了配置AP的例程,于是做了第一次代码修改尝试。DEMO虽然也支持额外配置,但商用的时候厂家们估计都想烧完程序,AP就直接展示自己的信息吧。

官网例程连接:http://bbs.espressif.com/viewtopic.php?f=21&t=227&sid=352ff16f67ee80289e08145c0a5f281b

本文作者twowinter,转载请注明作者:http://blog.csdn.net/iotisan/

1.函数如下,就修改了SSID。

/********************************************************************
* FunctionName : user_set_softap_config
* Description : set SSID and password of ESP8266 softAP
* Parameters : none
* Returns : none
*********************************************************************/
void ICACHE_FLASH_ATTR
user_set_softap_config(void)
{
struct softap_config config;

wifi_softap_get_config(&config); // Get config first.

os_memset(config.ssid, 0, 32);
os_memset(config.password, 0, 64);
os_memcpy(config.ssid, “DD_GO”, 7);
os_memcpy(config.password, “12345678”, 8);
config.authmode = AUTH_WPA_WPA2_PSK;
config.ssid_len = 0;// or its actual length
config.max_connection = 4; // how many stations can connect to ESP8266 softAP at most.

wifi_softap_set_config(&config);// Set ESP8266 softap config .

}

2.在user_esp_platform_init(void)中进行调用。

3.make… download… reboot……………..


0 0
原创粉丝点击