README.md
1# Blink Example
2
3(See the README.md file in the upper level 'examples' directory for more information about examples.)
4
5This example demonstrates how to blink a LED using GPIO or RMT for the addressable LED, i.e. [WS2812](http://www.world-semi.com/Certifications/WS2812B.html).
6
7See the RMT examples in the [RMT Peripheral](../../peripherals/rmt) for more information about how to use it.
8
9## How to Use Example
10
11Before project configuration and build, be sure to set the correct chip target using `idf.py set-target <chip_name>`.
12
13### Hardware Required
14
15* A development board with ESP32/ESP32-S2/ESP32-S3/ESP32-C3 SoC (e.g., ESP32-DevKitC, ESP-WROVER-KIT, etc.)
16* A USB cable for Power supply and programming
17
18Some development boards use an addressable LED instead of a regular one. These development boards include:
19
20| Board | LED type | Pin |
21| -------------------- | -------------------- | -------------------- |
22| ESP32-C3-DevKitC-1 | Addressable | GPIO8 |
23| ESP32-C3-DevKitM-1 | Addressable | GPIO8 |
24| ESP32-S2-DevKitM-1 | Addressable | GPIO18 |
25| ESP32-S2-Saola-1 | Addressable | GPIO18 |
26| ESP32-S3-DevKitC-1 | Addressable | GPIO48 |
27
28See [Development Boards](https://www.espressif.com/en/products/devkits) for more information about it.
29
30### Configure the Project
31
32Open the project configuration menu (`idf.py menuconfig`).
33
34In the `Example Configuration` menu:
35
36* Select the LED type in the `Blink LED type` option.
37 * Use `GPIO` for regular LED blink.
38 * Use `RMT` for addressable LED blink.
39 * Use `RMT Channel` to select the RMT peripheral channel.
40* Set the GPIO number used for the signal in the `Blink GPIO number` option.
41* Set the blinking period in the `Blink period in ms` option.
42
43### Build and Flash
44
45Run `idf.py -p PORT flash monitor` to build, flash and monitor the project.
46
47(To exit the serial monitor, type ``Ctrl-]``.)
48
49See the [Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html) for full steps to configure and use ESP-IDF to build projects.
50
51## Example Output
52
53As you run the example, you will see the LED blinking, according to the previously defined period. For the addressable LED, you can also change the LED color by setting the `pStrip_a->set_pixel(pStrip_a, 0, 16, 16, 16);` (LED Strip, Pixel Number, Red, Green, Blue) with values from 0 to 255 in the `blink.c` file.
54
55```
56I (315) example: Example configured to blink addressable LED!
57I (325) example: Turning the LED OFF!
58I (1325) example: Turning the LED ON!
59I (2325) example: Turning the LED OFF!
60I (3325) example: Turning the LED ON!
61I (4325) example: Turning the LED OFF!
62I (5325) example: Turning the LED ON!
63I (6325) example: Turning the LED OFF!
64I (7325) example: Turning the LED ON!
65I (8325) example: Turning the LED OFF!
66```
67
68Note: The color order could be different according to the LED model.
69
70The pixel number indicates the pixel position in the LED strip. For a single LED, use 0.
71
72## Troubleshooting
73
74* If the LED isn't blinking, check the GPIO or the LED type selection in the `Example Configuration` menu.
75
76For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon.
77