Arduino for esp8266 commonly used functions

Serial.print ( "transmission subject"); serial output is typically a string

Serial.println (config.key); serial output may be int

Serial.printf ( "\ r \ nMAC address:% 02X \ r \ n", mac [5]); serial output, the output format

Serial.begin (115200); Baud rate: 115200/9600 common

ESP.wdtFeed (); feed the dog / resource release

ESP.getSdkVersion (); Get the SDK version of the device

ESP.getFreeHeap (); acquisition memory size

ESP.restart (); reboot

WiFi.mode(WIFI_AP_STA);WiFi模式( WIFI_AP_STA / WIFI_AP )

WiFi.disconnect (); WiFi disconnect

WiFi.localIP (); WiFi local IP

if (WiFi.status ()! = WL_CONNECTED) determines whether the WiFi connection, if the connection is not WiFi, Zuosha

WiFi.stopSmartConfig (); a stop key distribution network

WiFi.beginSmartConfig (); beginning of a key distribution network

if (WiFi.smartConfigDone ()) a key distribution network has been completed

WiFi.macAddress (mac); mac address, obtaining mac [n] in an array

WiFi.hostname (temp); WiFi set the hostname

WiFi.begin (config.stassid, config.stapsw); WiFi connection start, (WiFi name, WiFi password)

strcpy (config.stapsw, WiFi.psk () c_str ().); Copy String

strcpy (config.stassid, WiFi.SSID () c_str ().); Copy String

if (strcmp (config.stassid, DEFAULT_STASSID)! = 0) string comparison function, if the return is equal to 0

 

EEPROM.begin (1024); ROM starts 1024 bytes

EEPROM.write (i, * (p + i)); ROM write al., (The first few characters pointer)

EEPROM.commit (); ROM write completion, close the IO stream

EEPROM.read (i); ROM read

Guess you like

Origin www.cnblogs.com/Lonelychampion/p/12120195.html