A simple esp8266 rgb lamp controllable by an TCP API.
- Install
PlatformIO - Create a
.envbased onenv_example - Plug a esp8266 to your computer
pio run -t upload -t monitor- get the server IP from here
- Get lamp IP from console or monitor UDP broadcast on port 12345 coming from it with the message "openupitsme"
- I recommend using wireshark to monitor and get a feeling for it!
- send 6 bytes through TCP to get color/alter color:
.-----------------------------------------------------.
| length | P or G |pwn_step| R | G | B |
| 1 byte | 1 byte | 1 byte | 1 byte | 1 byte | 1 byte |
`-----------------------------------------------------´
length- always 6.P or G-Pto change color and fade effect intensity,Gto get these information- if
Gis used, all the other bytes are ignored, but must still be sent
- if
pwm_step- fade effect intensity. Range from 0 to 100.RGBfields - range from 0 to 100 each.
- receive back
.-----------------------------------------------------.
| length | status |pwn_step| R | G | B |
| 1 byte | 1 byte | 1 byte | 1 byte | 1 byte | 1 byte |
`-----------------------------------------------------´
length- always 6.status-1if OK,0on error.pwm_step- fade effect intensity. Range from 0 to 100.RGBfields - range from 0 to 100 each.
- Change colors with PWM
- Connect to wifi
- Accept TCP connection
- Respond TCP connection
- Optional
POSTparameters- duration of fade effect to new RGB color
-
GETpwm_stepandrgb - return
pwm_stepandrgbinPOST - respond to discovery broadcast message
- Qt App
- discover lamp ip
- change color