3. Sample Codes
3.1. Directory Structure of RTOS SDK
ESP8266 RTOS SDK can be downloaded via the following link:"
ESP8266 RTOS SDK.
Below is the directory structure of the ESP8266 RTOS SDK.
• bin: boot and initialization firmware.
• documents: ESP8266_RTOS_SDK files.
•
driver_lib: sample codes for drivers.
•
examples: sample codes for Espressif’s application programs.
- openssl_demo: OpenSSL-API-related sample codes.
- project_template: sample codes for a project template.
- smart_config: SmartConfig-related sample codes.
- spiffs_test: SPIFFS-related sample codes.
- websocket_demo: WebSocket-related sample codes.
• include: header files of ESP8266_RTOS_SDK, including software interfaces and
macro functions for users to use.
• ld: linker scripts used for compiling; users do not need to modify them.
• lib: library files provided in ESP8266_RTOS_SDK.
• third_party: third-party library of Espressif’s open-source codes, currently including
freeRTOS, JSON, lwIP, mbedTLS, noPoll, OpenSSL, SPIFFS, and SSL.
• tools: tools; users do not need to modify them.
3.2. Basic Examples
Some basic examples are listed below:
• Initialization
•
How to read the ID of the chip
• How to set the Wi-Fi working mode
‣ when ESP8266 works in Station mode, it can be connected to the AP (router)
‣
when ESP8266 works in SoftAP mode, it can be connected to other Stations
•
Events that will be triggered when the Wi-Fi connection state changes
• How to read and set the MAC address of the chip
• How to scan APs nearby