uploaded 1 month ago
LED indicator driver

readme

## LED Indicator

As one of the simplest output peripherals, LED indicators can indicate the current operating state of the system by blinking in different types. ESP-IoT-Solution provides an LED indicator component with the following features:

* Can define multiple groups of different blink types
* Can define the priority of blink types
* Can set up multiple indicators
* LEDC and other drivers support adjustable brightness, gradient
* Support adjustment light with gamma
* Supports LED strips types like WS2812 and SK6812, and offers gradual color transitions based on the color wheel, brightness transitions, and the ability to specify LED index.

### Support LED Types

| LED TYPES  | ON_OFF | Brightness | Breath | Color | Color ring | Addressable |
| :--------: | :----: | :--------: | :----: | :---: | :--------: | :---------: |
|  GPIO LED  |   √    |     ×      |   ×    |   ×   |     ×      |      ×      |
|  PWN LED   |   √    |     √      |   √    |   ×   |     ×      |      ×      |
|  RGB LED   |   √    |     √      |   √    |   √   |     √      |      ×      |
| LED strips |   √    |     √      |   √    |   √   |     √      |      √      |

### LED Indicator User Guide

Please refer: https://docs.espressif.com/projects/esp-iot-solution/en/latest/display/led_indicator.html

changelog

# ChangeLog

## v0.9.2 - 2024-2-4

* Fixed test_led_indicator.c build in C++ error
* Upgraded the display effect of color gradient.

## v0.9.1 - 2024-1-17

* Resolve the issue of calling preempt_stop with a specified blink_type that is not running, causing the current preemptive blink to stop.
* Resolve the issue of the RGB ring not functioning.
* Ensure that preempt_start stops the previous preemptive blink.
* Add examples

## v0.9.0 - 2023-11-28

### BUG FIX

* Resolve the error with 'is_active_level_high' in LEDC RGB type.

### Break Change

* Remove `led_indicator_strips_config_t:is_active_level_high`

* Remove `led_indicator_get_handle`, the query of 'led_indicator handle' through GPIO number and LEDC channel is no longer supported.

## v0.8.0 -2023-11-21

### Enhancements:

* Supports RGB lights with three beads

## v0.7.2 - 2023-11-23

* Fix possible cmake_utilities dependency issue

## v0.7.1 - 2023-10-15

### BUG FIX

* Fix set HSV hue color.

### Enhancements:

* Added API for set color by temperature.

## v0.7.0 - 2023-11-09

### Enhancements:

* Renamed function `get_current_fade_value` to `get_brightness`.

* Added get functions for color (in RGB and HSV color format).

## v0.6.1 - 2023-10-31

### BUG FIX

* Fix preempt blink not stop as expected.

### Enhancements:

* Support LED RGB type by driver [led_strip](https://components.espressif.com/components/espressif/led_strip)

* Add api to control led indicator's brightness, HSV color, RGB color in real time

* Support change led indicator's color by type HSV and RGB.

* Support color gradient modification based on the color ring.

## v0.5.1 - 2023-10-23

### BUG FIX

* Fix the issue that led_indicator is destroyed but timer is still running.

## v0.5.0 - 2023-10-7

### Enhancements:

* Simplified the initialization process for LEDC.

### BUG FIX

* Resolved the blink issue in the breathing mode.

## v0.4.0 - 2023-4-12

### Enhancements:

* LED INDICATOR:
  * Add gamma adjustment
  * Update test_apps

## v0.3.0 - 2023-1-31

### Enhancements:

* LED INDICATOR:
  * Support customer mode: can customize multiple drivers
  * Support create LED by LEDC driver
  * Support breathe blink
  * Support set brightness
  * Support jump in line

## v0.2.0 - 2022-12-28

### Enhancements:

* LED INDICATOR:
  * Support customer-defined blink step
  * Support custom blink type

readme of indicator/gpio example

                                        
                                        ## LED Indicator WS2812

* Support ON/OFF

### Hardware Required

* LED

### Configure the project

```
idf.py menuconfig
```

* Set `EXAMPLE_GPIO_NUM` to set led gpio.
* Set `EXAMPLE_GPIO_ACTIVE_LEVEL` to set gpio level when led light

### How to USE

If the macro `EXAMPLE_ENABLE_CONSOLE_CONTROL` is enabled, please use the following method for control; otherwise, the indicator lights will flash sequentially in order.

* Help
    ```shell
    help
    ```

* Immediate display mode, without considering priority.
    ```shell
    led -p 0 # Start
    led -p 2 # Start
    led -x 2 # Stop
    ```

* Display mode based on priority.
    ```shell
    led -s 0 # Start 0
    led -s 2 # Start 2
    led -e 2 # Stop 2
    ```

Note:
> Support replacing the LED with an active buzzer to achieve the functionality of a buzzer indicator.
                                    

readme of indicator/ledc example

                                        
                                        ## LED Indicator WS2812

* Support ON/OFF
* Support set brightness
* Support breathe with brightness

### Hardware Required

* LED

### Configure the project

```
idf.py menuconfig
```

* Set `EXAMPLE_GPIO_NUM` to set led gpio.
* Set `EXAMPLE_GPIO_ACTIVE_LEVEL` to set gpio level when led light

### How to USE

If the macro `EXAMPLE_ENABLE_CONSOLE_CONTROL` is enabled, please use the following method for control; otherwise, the indicator lights will flash sequentially in order.

* Help
    ```shell
    help
    ```

* Immediate display mode, without considering priority.
    ```shell
    led -p 0 # Start
    led -p 2 # Start
    led -x 2 # Stop
    ```

* Display mode based on priority.
    ```shell
    led -s 0 # Start 0
    led -s 2 # Start 2
    led -e 2 # Stop 2
    ```

Note:
> Support replacing the LED with a passive buzzer to accomplish the functionality of a buzzer indicator light.
                                    

readme of indicator/rgb example

                                        
                                        ## LED Indicator WS2812

* Support ON/OFF
* Support set brightness
* Support breathe with brightness
* Support set hsv color
* Support set rgb color
* Support color ring with hsv
* Support color ring with rgb

### Hardware Required

* RGB LED

### Configure the project

```
idf.py menuconfig
```

* Set `EXAMPLE_GPIO_RED_NUM` to set led red gpio.
* Set `EXAMPLE_GPIO_GREEN_NUM` to set led green gpio.
* Set `EXAMPLE_GPIO_BLUE_NUM` to set led blue gpio.
* Set `EXAMPLE_GPIO_ACTIVE_LEVEL` to set gpio level when led light

### How to USE

If the macro `EXAMPLE_ENABLE_CONSOLE_CONTROL` is enabled, please use the following method for control; otherwise, the indicator lights will flash sequentially in order.

* Help
    ```shell
    help
    ```

* Immediate display mode, without considering priority.
    ```shell
    led -p 0 # Start
    led -p 2 # Start
    led -x 2 # Stop
    ```

* Display mode based on priority.
    ```shell
    led -s 0 # Start 0
    led -s 2 # Start 2
    led -e 2 # Stop 2
    ```

                                    

readme of indicator/ws2812_strips example

                                        
                                        | Supported Targets | ESP32 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |

## LED Indicator WS2812

* Support ON/OFF
* Support set brightness
* Support breathe with brightness
* Support set hsv color
* Support set rgb color
* Support color ring with hsv
* Support color ring with rgb
* Support set by index

### Hardware Required

* WS2812 Strips
* ESP32 SOC Support RMT

### Configure the project

```
idf.py menuconfig
```

* Set `EXAMPLE_WS2812_GPIO_NUM` to set ws2812 gpio.
* Set `EXAMPLE_WS2812_STRIPS_NUM` to set ws2812 number.

### How to USE

If the macro `EXAMPLE_ENABLE_CONSOLE_CONTROL` is enabled, please use the following method for control; otherwise, the indicator lights will flash sequentially in order.

* Help
    ```shell
    help
    ```

* Immediate display mode, without considering priority.
    ```shell
    led -p 0 # Start
    led -p 2 # Start
    led -x 2 # Stop
    ```

* Display mode based on priority.
    ```shell
    led -s 0 # Start 0
    led -s 2 # Start 2
    led -e 2 # Stop 2
    ```

![flowing leds](https://dl.espressif.com/ae/esp-iot-solution/led_indicator_ws2812.gif)
                                    

Links

Supports all targets

License: Apache-2.0

To add this component to your project, run:

idf.py add-dependency "espressif/led_indicator^0.9.2"

or download archive

Dependencies

  • espressif/cmake_utilities 0.*
  • ESP-IDF >=4.0
  • espressif/led_strip >=2.5.2
  • Examples:

    indicator/gpio

    more details

    To create a project from this example, run:

    idf.py create-project-from-example "espressif/led_indicator^0.9.2:indicator/gpio"

    or download archive (57 bytes)

    indicator/ledc

    more details

    To create a project from this example, run:

    idf.py create-project-from-example "espressif/led_indicator^0.9.2:indicator/ledc"

    or download archive (57 bytes)

    indicator/rgb

    more details

    To create a project from this example, run:

    idf.py create-project-from-example "espressif/led_indicator^0.9.2:indicator/rgb"

    or download archive (57 bytes)

    indicator/ws2812_strips

    more details

    To create a project from this example, run:

    idf.py create-project-from-example "espressif/led_indicator^0.9.2:indicator/ws2812_strips"

    or download archive (57 bytes)

    Stats

    • Archive size
      Archive size: 34.88 KB
    • Downloaded in total
      Downloaded in total 5.8k times
    • Downloaded this version
      This version: 2.2k times

    Badge

    espressif/led_indicator version: 0.9.2
    |