Here is my problem. I'm working on making a wifi addressable RGB LED (like WS2812b) controller, I'm using an ESP8266 as the hardware. I'm also creating a phone application for controlling the device and setting different modes. What I'm doing right now is that I communicate with the module by sending GET commands from my phone app. For example to change the brightness I send http://192.168.4.1/I125I
Then on the ESP side the code is as follows:
WiFiClient client = server.available();
if (client) {
String inData= client.readStringUntil('\r');
if (inData.indexOf("I")!=-1){
BRIGHTNESS=str2int(inData.substring(inData.indexOf("I")+1,inData.lastIndexOf("I")));
}}
It works, but I'm not sure if this way of sending data is efficient at all. if change colors too rapidly the ESP resets. I recently found another code that uses GET and POST commands but different methods are used, like the following
server.on("/brightness", HTTP_POST, []() {
adjustBrightness();
});
Then inside adjustBrightness function brightness is adjusted. This way it looks more professional but Is it more efficient?
I recently bought a commercial RGB LED controller that uses ESP8266 as its core. I tried to see what the phone app sends to the controller using the Drony app. For my app I could see all the get command the app was sending
192.168.4.1/I255I
192.168.4.1/R200RG90GB76B
...
but for the commercial controller I just saw one connection, something like "157.10.12.10:5172"
Is this using websockets? Is using websocket a better way? is it more robust?
I'm writing the code in Arduino IDE.