RGB Light Control
This widget is intended to allow you to control an RGB connected to your hardware. It not only allows you to dynamically set the color, but you can also turn the RGB on/off, set the brightness, and choose custom animation effects.
Datastream
Four datastreams are required for this widget:
COLOR - select or create a datastream of data type string for the color. The three RGB color values are independently available to be read by the hardware.
BUTTON - select or create a datastream of data type integer or double with the minimum and maximum values that will turn on/off the RGB connected to the hardware..
BRIGHTNESS - select or create a datastream of data type integer or double to represent the color intensity, with a minimum value of 0 and a maximum value of 100.
ANIMATION SPEED - select or create a datastream of data type integer or double with a range of values from 0 to 10,000.
Widget properties (label, color, etc.) are also changed via the datastreams, but only for virtual, enumerable, and location pins, not digital and analog pins.
Mode
The Color Circle displays a rainbow of colors. The user moves the Color Picker radially around the Color Circle to choose a particular color. Tap one of three radio buttons to select between the Color, White, and Animation modes.
Color Mode: The user selects a hue/color on the Color Circle using the Color Picker. The Radial Slider allows the user to select a luminance (brightness) varying from 0 to 100.
White Mode: When the ‘White Tints’ option is selected, white tints may be selected with the Color Picker (red 219 to 255, green 219 to 255, blue 169 to 255). When the ‘White Only’ option is selected, the Color Picker is disabled, the RGB values are set to white, and only the brightness may be adjusted with the radial slider.
Animation Mode: Choose the animation type by selecting the Strobe/Fade button, or the Change button for a pattern selection. The radial slider sets the animation speed in the range of 0 to 1000. The Color Picker is disabled.
The RGB Light Control widget in Color Mode or White Mode with White Tints option generates RGB color values for a common cathode RGB. If you are using a common anode RGB with your hardware, then you need to adjust the values in your firmware by subtracting each of them from 255.
Settings
WHITE MODE - The ‘White Tints’ option allows you to choose white tints with the Color Picker. The ‘White Only’ disables the Color Picker and only the white brightness may be adjusted with the radial slider.
Send on release - enable to only update the datastreams when the control is released by the user (recommended). Otherwise the datastreams will be continuously updated based on the color chosen until the control is released.
Sketch: Basic Sketch
Sketch: NeoPixel
Detailed guide with the firmware example in our blog post.
Change Widget Properties
You can change certain properties of the Widget from your hardware. For that, use this command:
Where:
vPin
is: virtual pin number the widget is assigned towidgetProperty
: property you want to changepropertyValue
: value of the property you want to change
Don't put Blynk.setProperty()
into the void loop()
as it can cause a flood of messages and your hardware will be disconnected. Send such updates only when necessary, or use timers.
Properties you can change
You can change the properties “isDisabled” and “isHidden” of the widget from your hardware, or via an HTTP API. The URL must be encoded, so spaces in labels must be replaced with %20, and color hexadecimal values in the HTTP API URL must include the hash # character urlencoded as %23.
Disable/Enable
Widget will be greyed out on UI and users won't be able to tap on it.
Show/Hide
Widget will be hidden from dashboard. Design your UI so that it doesn't look weird when there is no widget.
Change widget properties via HTTPs API
Updates the Datastream Property and all assigned Widgets
GET
https://{server_address}/external/api/update/property?token={your 32 char token}&pin={your vPin}&{property}={value}
The endpoint allows you to update the Datastream Property value via GET request. All widgets (both web and mobile) that are assigned to this datastream will inherit this property. The Datastream Property is persistent and will be stored forever until you change it with another value. In order to clear the property you need to clear the device data in device actions menu.
Example:
https://blynk.cloud/external/api/update/property?token=GVki9IC70vb3IqvsV0YD3el4y0OpneL1&pin=V1&isDisabled=true
Path Parameters
Name | Type | Description |
---|---|---|
{server address}* | string | Get from the bottom right of your Blynk console. More information. |
Query Parameters
Name | Type | Description |
---|---|---|
token* | string | Device auth token from Device info |
pin* | string | The datastream virtual pin (should start with "v") |
{property} | string | The property of the widget you want to update: |
isDisabled | string | true or false |
isHidden | string | true or false |
Sync to the latest known state
You can update your hardware to the latest datastream value from Blynk.Cloud after your hardware went offline, and then came online again. Use Blynk.syncVirtual()
to update a single virtual pin, or Blynk.syncAll()
to update all virtual pins. See State Syncing for more details.
Last updated