A simple esp8266 rgb lamp controllable by an TCP API.
- Install
PlatformIO
- Create a
.env
based 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
-P
to change color and fade effect intensity,G
to get these information- if
G
is used, all the other bytes are ignored, but must still be sent
- if
pwm_step
- fade effect intensity. Range from 0 to 100.RGB
fields - 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
-1
if OK,0
on error.pwm_step
- fade effect intensity. Range from 0 to 100.RGB
fields - range from 0 to 100 each.
- Change colors with PWM
- Connect to wifi
- Accept TCP connection
- Respond TCP connection
- Optional
POST
parameters- duration of fade effect to new RGB color
-
GET
pwm_step
andrgb
- return
pwm_step
andrgb
inPOST
- respond to discovery broadcast message
- Qt App
- discover lamp ip
- change color