Skip to content

Latest commit

 

History

History
48 lines (29 loc) · 1.22 KB

rgb_single.rst

File metadata and controls

48 lines (29 loc) · 1.22 KB

rgb_single

rgb_single(name, pin_r, pin_g, pin_b, invert=false);

Create a new rgb device object for an rgb-led connected to the pins pin_r (red pin), pin_g (green pin), and pin_b (blue pin). Name will be appended to the mqtt topic. If invert parameter is set to true, the outputs are inverted, for example 255,0,127 becomes 0,255,128.

Topics

Under the resulting topic will be the following subtopics:

  • set: turn on or off
  • brightness/status, brightness/set: read and set brightness (0-255)
  • rgb/status, rgb/set: read and set color as colorname, 6-digit hexcode (rrggbb) or comma separated triplet (r,g,b)

Parameters

  • name: the name it can be addressed via MQTT in the network. Inside the code it can be addressed via IN(name).
  • pin_r, pin_g, pin_b: the gpiopin for red, green, and blue lines
  • ignore_case: should case in the command detection be ignored

Example

node name: living room/tvlights

rgb_single(rgb1, D3, D4, D2);

Now the RGB LED can be switched to red via sending to the mqtt-broker to the topic living room/tvlights/rgb1/rgb/set the command red.