Widget Menu Problem

Hello ,
The project is:
Control an Esp32 via a smartphone …
The idea is to light independent LEDs with an effect selectable by the menu widget

I have already written the skeleton of the project…
There are several effects and a single on / off button and it is he who must activate the programmed effect …
My problem is that I can’t figure out where to start to continue the project

#include <WiFi.h>               //Bibliothèque Wifi
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <ezOutput.h> // ezOutput library

char auth[] = "";     //Réseaux
char ssid[] = "Claudine";
char pass[] = "cake2303";

WidgetTerminal terminal(V4);

ezOutput led(13);  // create ezOutput object that attach to pin 9;

void Flash(){
void Fixe(){
void SOS(){
void Beacon(){

void setup()
  // Debug console

  Blynk.begin(auth, ssid, pass);


void loop()

  int pinValue = param.asInt(); // assigning incoming value from pin V0 to a variable
  Serial.print("BUTTON : ");

  int frequence = param.asInt(); // assigning incoming value from pin V1 to a variable
  Serial.print("Frequence : ");

  switch (param.asInt())
    case 1: Serial.println("Flash"); Flash(); break;
    case 2: Serial.println("Fixe"); Fixe(); break;
    case 3: Serial.println("SOS"); SOS(); break;
    case 4: Serial.println("Beacon"); Beacon(); break;
    case 5: Serial.println("Matrice"); Matrice(); break;
    default: Serial.println("Mode inconnu");   

  int intensite = param.asInt(); // assigning incoming value from pin V3 to a variable
  Serial.print("Intensite : ");
} ```

Hoping not to have duplicated a topic

Blynk legacy or IOT ?

Thank you for your reply , i use legacy Blynk

Is there any reason why you’re creating this project in an unsupported product that will be decommissioned at some point in the future?


1 Like

Yes, it turns out that I have more freedom to use the old version rather than the new one because it no longer allows me to have the menu widget, I would have to pay to get it…

I just need someone to explain to me how the menu widget works maybe with an example, because the example provided by the library does not depend on anything

I assume that you’re meaning the example doesn’t have an on/off switch to activate the selected effect?

If that’s the case then I’d assign the value coming from the menu digital pin to a global variable, and have your switch/case statement in a separate function.
You then call that function from the BLYNK_WRITE that is associated with the on/off button widget, provided that the value coming from the widget is a 1 (on).
If it’s a 0 (off) then you stop the effects.
This value should also be assigned to a global variable so that it can be used like this…

If you want to change effects while the switch is on, you call the function that contains the switch/case function, provided that the last value that came from the on/off button widget was a 1 (on).


Thanks , it seems good ,
I tell you
could you write two or three lines of code? I’m not comfortable with functions

No, I’m not writing your project for you.


oops sorry, that’s not what I meant, I was thinking of a concise example to have a structure that I can follow or even an annotation on the code above…:sweat_smile:

This might help you

Thanks, I’ll take a look