BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Zergba code (or Use Sliders to control RGB led)


#1

Hi guys,
I would like to know the code used to make Zergba .
And if it’s possible to change the animal used.


#2

No. The picture is probably just part of the graphic design anyhow, not the code. But the App is NOT open source, so we can’t see or change it.

But you can easily duplicate the output data with three sliders and not use the zeRGBa if you really have an aversion to zebras :smiley:


#3

My problem is I want to have a mode that will automatically change the color of the rgb without me doing it manually and that over and over again. Like a sort of fading


#4

Google for one of the many codes that do exactly such. Then adapt for Blynk GUI control as required.


#5

I already have the code that can do it . I just don’t know how to make blynk do it using a button


#6

A Blynk button just supplies a value. Use some form of if x == y do z code to control your fade routine and use a Blynk button to supply the x


#7

Remember to avoid blocking loops for that purpose (for, while, do…)


#8

I also thought about using the blynk slider as a potentiometer (connecting the node MCU to an Arduino uno) but it just doesn’t give me the good values.
What i want is to use the blynk sliders and control the color manually and also be able push a button on the blynk app and have the automatic change happen.


#9

The thing is I want to use sliders in order to have more than 3 colors (red,green,blue) also want to control the brightness.


#10

The very nature of the intensity values to the R, G, & B portions dictate the brightness… so one way of using a standalone slider it is add or subtract a “brightness” value to all the other three sliders values at the same time.

As for an automated option… once you have the code to control the RGB LED, you can use random number generation to emulate the sliders and use the brightness to set limits of the random numbers.

Basically, everything you want to do requires coded routines… none of which is Blynk specific. Blynk just allows another way of supplying a user interface to those coded routines.


#11

So there is no way I can use the sliders information(I would consider each on of them as potentiometers) to control an arduino uno.
For example link the D1 D2 and D3 outputs (that are respectively connected to the blynk sliders) to A0 ,A1 and A2 (analog inputs) of the arduino.

The arduino uno would just help me take the value of D1 , D2 and D3 and apply them to pin 11,10 and 9

I don’t know if you understand me but I am saying that I would like take the information of the sliders to use them through an arduino uno


#12

Umm, not quite the correct way of doing a cross device communication :wink: For one thing, the ESP only outputs 3.3v so its PWM output wouldn’t properly register as the full range of the Arduino’s ADC inputs.

Why run seperate devices anyhow? You should be able to merge the Arduino RGB code into the ESP and instead of looking for the ADC for input, look to the value supplied by the slider code.


#13
                            Please help 

So here is my problem. I wrote a code on my arduino UNO that can change the color of my RGB led automatically. (Red, pink, yellow ,blue, magenta,green etc) it’s just like fading, it does this over and over

. now I want to be able to chose one color thanks to blynk sliders. But I don’t want to connect my node MCU directly to the RGB led. I want to connect it to my arduino uno and then use the Sliders values to control the color of my RGB led.

The thing is I connected the blynk sliders pins(respectively D1,D2 and D3) to A0 , A1 and A2 of my arduino uno in order to control the red pin(11), greenpin(10) and blue pin(9 ) : pmw pins

then I wrote in my code
{AnalogWrite(11, analogRead(A0));
AnalogWrite(10,analogRead(A1));
AnalogWrite(9,AnalogRead(A2));
}
My purpose is to use the blynk sliders as virtual potentiometers but it just doesn’t give me the right values. Right from the start without moving the sliders I get a blue light ) therefore I can never get the colors I want when moving the sliders.


#14

NOPE! Not the correct forum procedure :stuck_out_tongue: You already have this topic created… Please do not create other topics for same/similar/related issue.

I merged both.

Read my response above for the reason you are not getting the results you are looking for.

If you really want to keep seperate devices, then you can try another library like this to share data between them.


#15

OK thanks will look at this


#16

So here it is I want to do it in a other way and write the color change code directly in the esp. But I don’t really know how to write Blynk codes .
Can I do something like if I push a button on the app D5( for example ) then blynk will run my code ?? I’m not sure how to write this since blynk seems to use a slightly different vocabulary


#17

Blynk is basically a library (well, much more, but for simple explanation this works :stuck_out_tongue_winking_eye: )… and like all libraries it has its own formats, commands, layouts, etc. There is no magic answer on how to run existing code with Blynk (or another GUI App).

There is the Documents, Help Center and Sketch Builder (links at the top of this page) available to learn how Blynk works.

Once you understand that, it should be easier for you to merge your RGB code with Blynk’s slider/button control options.