Widget Properties
Changing some of the widget properties from hardware side is also supported. For example, you can change the color of LED widget based on a condition:
1
//change LED color
2
Blynk.setProperty(V0, "color", "#D3435C");
3
4
//change LED label
5
Blynk.setProperty(V0, "label", "My New Widget Label");
6
7
//change MENU labels
8
Blynk.setProperty(V0, "labels", "Menu Item 1", "Menu Item 2", "Menu Item 3");
Copied!
NOTE : Changing these parameters work only for widgets attached to Virtual pins (analog/digital pins won't work).
color, label widget properties are supported for all widgets :
label is string for label of all widgets.
color is string in HEX format (in the form: #RRGGBB, where RR (red), GG (green) and BB (blue) are hexadecimal values between 00 and FF). For example :
1
#define BLYNK_GREEN "#23C48E"
2
#define BLYNK_BLUE "#04C0F8"
3
#define BLYNK_YELLOW "#ED9D00"
4
#define BLYNK_RED "#D3435C"
5
#define BLYNK_DARK_BLUE "#5F7CD8"
Copied!
On firmware side, widget objects also support setLabel() and setColor() functions.
Widget specific properties:
Button
onLabel / offLabel is string for ON/OFF label of button;
Styled Button
onLabel / offLabel is string for ON/OFF label of button;
onColor / offColor is string in HEX format for ON/OFF colors of the button;
onBackColor / offBackColor is string in HEX format for ON/OFF colors of the button background.
Music Player
isOnPlay is boolean accepts true/false.
1
Blynk.setProperty(V0, "isOnPlay", "true");
Copied!
Menu
labels is list of strings for Menu widget selections;
1
Blynk.setProperty(V0, "labels", "label 1", "label 2", "label 3");
Copied!
Video Streaming
1
Blynk.setProperty(V1, "url", "http://my_new_video_url");
Copied!
Step
1
Blynk.setProperty(V1, "step", 10);
Copied!
Image
1
Blynk.setProperty(V1, "opacity", 50); // 0-100%
Copied!
1
Blynk.setProperty(V1, "scale", 30); // 0-100%
Copied!
1
Blynk.setProperty(V1, "rotation", 10); //0-360 degrees
Copied!
also, you can fully replace the list of images from the hardware:
1
Blynk.setProperty(V1, "urls", "https://image1.jpg", "https://image2.jpg");
Copied!
or you can change individual image by it index:
1
Blynk.setProperty(V1, "url", 1, "https://image1.jpg");
Copied!
You can also change widget properties via HTTP API.
Last modified 7d ago
Copy link