Use the button widget to turn multiple gpio on and off

Hello Blynkers

I am a newbie to Blynk and I came up with an RGB LED strip Project . I have the blynk app on my android phone and I created a project on the esp8266 and added the widget zeRGBa to control the RGB strip. It worked fine but I am thinking to add the button widget to turn the lights on and off and the slider widget to control the brithness

Is it possible and can you maybe provide me with the code?
All help apriciated

Thankyou

Hello, we have a bunch of examples. Did you look into them? They are pretty self-descriptive. For instance here example of how you could catch button “press” event. If you put your button on virtual pin 1.

BLYNK_WRITE(V1)  
{
  if (param.asInt()) {
     //button presed
  } else {
      //button released
  }
}

I am planning to use the zeRGBa widget to control an rgb light strip can i still use this code to turn them on and off

yes, zeRGBA controls color and brightness. Just drag the circle down

Ok but i want external button to turn them on and off and a slider widget to control the brightness

I don’t know why would you like to add another widget if zeRGBa ca do that.

But yes, you can do so! :wink:

I know zeRGBA can but i still want to add another widget but how. Can you provide me with the code.
One last question. I am using the ESP8266 standalone and when a GPIO is set high the voltage is only 3.6 volt, I expected 5 volt

Add a slider and attach it to Virtual Pin

Use this example to get data from the slider and use it for brightness control. Same for the Button:

Yes after I get the data whats next can you give me the code

Now use the data from the slider to write it to brightness.

I can’t write code for you. You should figure out how to do that.

because ESP8266 work with 3.6V !!! NOT 5V

Yes I forgot that it works only with 3.3

I’m struggling to understand. I know I need to use a virtual pin to have a button turn my 5mm RGB LED on and off but I do not know how to assign the 3 digital pins to the 1 virtual pin.

My digital pins are D6,7,8 and I want to assign them to V1 so that I can have a button.

@ccidesign You should read this:

If there’s anything you don’t understand then create a new “Need help with my project” topic, and provide ALL of the relevant information that is requested when the topic is created.

Pete.

1 Like