Updated Macros (markdown)

This commit is contained in:
Christian Schwinne 2021-11-02 22:45:24 +01:00
parent 1e84c9eb0a
commit ff8aad40aa
1 changed files with 2 additions and 51 deletions

View File

@ -1,54 +1,5 @@
See [Presets](https://github.com/Aircoookie/WLED/wiki/Presets) for 0.11.0+.
Please see https://kno.wled.ge/features/macros/ for this information.
You are able to set custom actions ("Macros") in Time & Macro settings for the following events:
This wiki is now deprecated. Please consider contributing to kno.wled.ge by making improvements as a pull request. Thank you!
- Specific time of day
- Button short/long/double press
- HTTP API call executing a macro with "&M="
- Alexa On/Off
- Countdown over
- Timed light duration over
- Device (re)boot (up to 0.10.2, use LED settings `Boot preset` in 0.11)
Each macro has the format of a standard [HTTP API call](https://github.com/Aircoookie/WLED/wiki/HTTP-request-API) without the IP. Optionally, the "win&" may be omitted.
For example, the macro "A=255" sets the brightness to maximum. "R=255&G=160&B=0" sets the color to orange.
You can specify up to 16 macros. (up to 250 in WLED 0.11 since the Macro functionality has been merged into the Presets feature)
Examples of how to use API-calls and define macros can be found in [this issue](https://github.com/Aircoookie/WLED/issues/801#issuecomment-635600255) and [in this one](https://github.com/Aircoookie/WLED/issues/199#issuecomment-520143239).
The simplest macro example is getting a button to do your bidding. The default pin to which a button can be connected is GPIO 0 (D3 on NodeMCU, D1 Mini and others). This pin is ideally pulled high to 3.3V with a 10k resistor and the configured macro executes when the pin is pulled low (grounded). The desired macro is entered on the Time/Macros configuration page and then assigned to a short, long or double press. Like this:
![how to wire a button to D3 and set up a macro](https://user-images.githubusercontent.com/40203361/64235553-e3c41300-cef8-11e9-833f-c5062aaba124.jpg)
The "T=2" macro toggles power to the LEDs (in this case long press).
The "FX=~" macro steps through the effects (in this case short press).
The default (built-in) actions are short-press: toggle on/off and long-press: select random color.
## Buttons
Multiple buttons are implemented since 0.13 and allow a few different types of _buttons_ to be connected to the ESP:
- _momentary push-buttons_ that short GPIO pin to ground
- _momentary push-buttons_ that short GPIO pin to +3.3V (inverted)
- _switches_ (be careful with selection of GPIO for switch since some GPIOs will prevent successful boot of ESP if held LOW or HIGH at boot)
- _PIR switch_ AKA motion detection sensor (they set GPIO HIGH when motion is detected, this type of buttons will also trigger MQTT message with /motion topic)
- some GPIO pins on ESP32 can act as _momentary touch buttons_ with no additional hardware
- analog "buttons" (also with inverted logic) those can be used as potentiometers or analog input buttons
Button GPIO pin and type can be selected in _LED Settings_ page.
Each momentary button can have 3 different [Presets](https://github.com/Aircoookie/WLED/wiki/Presets) assigned, for short press, long press or double press. For switch type buttons you can assign only 2 presets, one for transition of switch from LOW to HIGH and second for the opposite transition from HIGH to LOW.
Selecting 0 for preset will set _default_ action. If you find that default action is _inverted_ for switch, please create presets for On and Off actions and assign them appropriately.
For assigning [Presets](https://github.com/Aircoookie/WLED/wiki/Presets) to buttons use _Time & Macros_ settings page.
### Analog button
Starting in WLED 0.13, analog "buttons" (e.g. a potentiometer) are supported.
Set the `Double` column in Button Actions to one of these values to configure:
| Property | Value |
| --- | --- |
Global brightness | 250
Effect speed | 249
Effect intensity | 248
Palette | 247
Primary color hue | 200
Segment N opacity | 0-32