Smart Home (2) mobile phone One-click Self-configuration app

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.