In this guide we show how to setup and use the ESP8266 / ESP32 Wifi remote plugin for use in the menu library. This plug-in works with most ESP boards.
ESP WiFi is quite easy to set up as it’s built into the device. However, when using any ESP board and ESP8266 especially you must make sure that you frequently yield control to the runtime. If you are using task manager exclusively this should not be an issue.
It is your responsibility to configure and initialise the WiFi adapter before calling
setupMenu in the general application setup. See the section further down on sketch requirements.
First, ensure that you’ve chosen the right “Embedded Platform” type which should be either
ESP8266 to match your board, then ensure your menu structure is saved and lastly choose Code -> Generate Code from the menu. Once the code generation dialog appears, to the right of the current remote type will be a button named “Change”. Click this button choose the appropriate ESP plugin for your board. For example:
The only parameter for ethernet connections is the listen port parameter, this is the port on which the server socket should listen for connections. The default is 3333.
It is your responsibility to fully initialise the network stack before calling
setupMenu either in Access Point or Station mode. You must either choose DHCP configuration where an IP address will be automatically assigned, or you must configure one manually.
The absolute minimum that you’ll need to do to start the WiFi is call the following before setup:
WiFi.begin(ssid, password); WiFi.mode(WIFI_STA);
Take a look at the example esp8266WifiOled packaged with tcMenu, which works for both ESP32 and ESP8266.