In merge mode, the zeRGBa widget writes a single message to the virtual pin, which consists of an array of values. As an example, if you have a zeRGBa widget connected to the virtual pin V1, you can parse each value for RGB on your Raspberry Pi as:
BLYNK_WRITE(V1) // zeRGBa assigned to V1
{
// get a RED channel value
int r = param[0].asInt();
// get a GREEN channel value
int g = param[1].asInt();
// get a BLUE channel value
int b = param[2].asInt();
}
The following steps explain how to add a zeRGBa widget to the canvas and configure it for use with virtual pins:
- In edit mode, tap the plus icon to open the Widget Box.
- Under Controllers, tap zeRGBa. A zeRGBa widget will be added to the canvas:
zeRGBa widget
- Tap the zeRGBa widget to open zeRGBa Settings:
zeRGBa Settings page
- Switch the toggle button under OUTPUT to the MERGE position:
zeRGBa widget in merge mode
- Tap PIN, and from the drop-down list choose Virtual, followed by V1. Then, tap OK.
- The zeRGBa Settings page should look like this:
Settings for use with Virtual pins
- Keep the other options on the settings page as they are. Tap the back arrow icon to go to the canvas. Now, your zeRGBa widget should look like this:
zeRGBa widget connected to the virtual pin V1