ESP8266 IoT Control RGBLED Light form Espressif IoT Demo Source Code
We introduce embedded applications based on Espressif’s SoC with WiFi connectivity ESP8266. The IoT demo applications here showcase how you can develop an entire application with this single SoC, and to realize smart connectivity.
The SDK provides a set of interfaces for data receive and transmit functions over the WiFi and TCP/IP layer so programmers can focus on application development on the high level. Users can easilymake use of the corresponding interfaces to realize data receive and transmit.
All networking functions on the ESP8266 IoT platform are realized in the library, and are not transparent to users.
System Diagram
Default IP address of SoftAP mode is 192.168.4.1. In station mode the IP address is assigned by router. The IP address in the URL represents IP in SoftAP and station mode depending on which is required.
Wiring Diagram
ESP8266 Pin GPIO_12 to R LED
ESP8266 Pin GPIO_13 to B LED
ESP8266 Pin GPIO_15 to G LED
How to Control ( HTTP Protocol )
GET Command Info http://192.168.4.1/client?command=info
Response
{
"Version": {
"hardware": "0.1",
"sdk_version": "1.3.0",
"iot_version": "v1.0.5t45772(a)"
},
"Device": {
"product": "Light",
"manufacturer": "Espressif Systems"
}
}
GET Light Status http://192.168.4.1/config?command=light
Response {
"period": 1000,
"rgb": {
"red": 22222,
"green": 22222,
"blue": 22222,
"cwhite": 22222,
"wwhite": 22222
}
}
POST Control Light in Red , Green , Blue http://192.168.4.1/config?command=light POST
JSON {"freq":100,"rgb":{"red":XXX,"green":XXX,"blue":XXX}}
Source Code
Mikhail Grigoriev’s Unofficial Development Kit for Espressif ESP8266.
The IoT demo source code of is in the "usr" folder, and the details are as follows:
user_main.c — main file
user_webserver.c — creates a TCP server, provides REST light weighted webserver function
user_devicefind.c — creates a UDP transmission, provides device look-up function
user_esp_platform.c — communicate with Espressif Cloud
user_json.c — json packet processing function
user_plug.c — demo of plug device
user_light.c — demo of PWM light device
user_humiture.c — demo of humidity-temperature sensor device
SDK Development Guide
http://bbs.espressif.com/viewtopic.php?f=51&t=1024
http://espressif.com/new-sdk-release/
My Blog
My Website