Open csabal opened 6 months ago
Hello There!
On top of the existing code in the main.cpp file (or the .ino file if on Arduino IDE), just add the necessary code to run the RGB LED. So on this page you would need to define some variables, some code for the setup section and some code for the loop section. The video you linked takes you through the code you need for each section. I would not change the ESP32Web.cpp file as I don't see a need to do so for your objective.
Hope that helps!
Hi,
Yeah that is clear, the rgb led is working I can change color etc. The only problem the blinking.
I was thinking that the blinking function coming from your code. But maybe I am wrong, I am still lame... :) very.
I should need a function or whatever, what blinking the rgb led, IF there is no a valid WIFI connection to the net. So, when the esp is AP mode, and it needs to configure via the wifi manager webpage. Which is so great!!!! Your work so good, it is clean, nice, easy to use...thanks-
Also, I attached an SSD1306 OLED screen, so I need coding to write something to the screen as well, while there is no connection. I saw many communication via the serial monitor, can I use those function to write something to the screen, as well?
Eh, so many problem. Maybe I gonna ask ChatGPT. :)
Glad to hear you like the library!
Ahhhah, a route to code events (LED's, OLED and etc) based on "no connection" & "connected" status' & to have to option to disable the default blinking behaviour. That's a really good idea!
Although, you could change up the ESP32Web.cpp to accomodate for such functionality, I think it might be easier if I just added a global flag variable to the library with connection status being "true" or "false". This way you can access this global flag variable in the main.cpp file (or the .ino file for Arduino IDE) and set up a if statement in the loop section based in this flag variable being "true" or "false". Will also allow the default blinking option to be disabled through somewhere.
I will try add this option to the library and update this post once done.
Feel free to ask more questions or suggest feature updates - would love to hear from everyone!
That is so great!!!!
I gonna wait for the update.
Meanwhile I go to customize the esp32web.local website....seems easy, your documentation rocks!
Thank you! I really appreciate your work!
I'm probably not going to get a chance to have a detailed look into this till next week. However, for the meantime here's how you can achieve what you're looking to do.
1) To stop the blinking, you can comment out the line 9 on main.cpp:
There may be other references to change the LED state in the ESP32web.cpp. You can find all references to "digitalWrite" in that file and adjust that accordingly or just comment it out.
2) In order to add conditional code in the main loop based on connection status, you utilise the "currentState" variable like follows:
To clarify, STA Mode means connection established, whereas AP Mode means no connection currently.
Hope that helps!
Hi
I have RGB Led connected to the ESP32 output pins. Your code works only with normal LED not RGB LED.
I am using this kind of RGB LED: https://youtu.be/fn9GxfaLK7k?si=c6UiJPdfQXGRysb1
Using your code, and configured to my blue pinout (LED_PIN 25), it is ON, when it should be, but it is not blinking at all....
How can I modify in ESP32Web.cpp at row 759 in order to blink OR change colors of the connected RGB LED, in AP mode. (so, at the first boot, when no wifi data collected. It should be blinking and/or changing color rapidly...or whatever, but it must be different)
I hope you can understand my question. :)
Thanks a lot in advance!