Description
This tutorial mainly records the app-side one-click Self-configuration function +TCP/IP Communication
0 supporting the use of single-chip computer burning
/* File name: Smartconfig.ino function: ESP8266 quick configuration function www.doit.am Date: 2015-12-31
Version: 1.0*/#include <ESP8266WiFi.h> #define LED 16int i =0;void smartconfig () { wifi.mode (wifi_sta); Serial.println ("\r\nwait for Smartconfig"); Wifi.beginsmartconfig (); while (1) { serial.print ("."); Digitalwrite (LED, 0); Delay (+); Digitalwrite (LED, 1); Delay (+); if (Wifi.smartconfigdone ()) { serial.println ("Smartconfig Success"); serial.printf ("ssid:%s\r\n", Wifi.ssid (). C_STR ()); serial.printf ("psw:%s\r\n", Wifi.psk (). C_STR ()); Break;}}} void Setup () { serial.begin (9600); Serial.println ("Start module"); Pinmode (LED, OUTPUT); Digitalwrite (LED, 0); Smartconfig ();} void Loop () { delay (+); Serial.println (i++);}
1 App-Side development
App source code URL
Https://www.espressif.com/zh-hans/products/software/esp-touch/resources
Description document
FILE:///C:/USERS/DONGDONG/DOWNLOADS/30B-ESP-TOUCH_USER_GUIDE_CN_V1.1_20160412%20 (2). pdf
New-Empty Project after download-Import source code
Go straight to the next step, generate the app directly, then click Debug
Then see the project file
(App is an empty project created by itself)
2 Code explanation
Key to generate an asynchronous thread task, link target WiFi
At the end of the task, a popup dialog returns the assigned address, which can be used for next communication
3 adding TCP/IP communication routines
Smart Home (2) mobile phone One-click Self-configuration app