From: hou wen xiang <houwenxiang@espressif.com>
Date: Fri, 29 Jun 2018 13:46:51 +0000 (+0800)
Subject: doc(ledc): Update LEDC example README.md file.
X-Git-Tag: v3.3-beta1~40^2
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ade39f823f036ee4d0f659f940945ab76435637a;p=esp-idf

doc(ledc): Update LEDC example README.md file.
---

diff --git a/examples/peripherals/ledc/README.md b/examples/peripherals/ledc/README.md
index fef24bf95d..dc8a25c2a3 100644
--- a/examples/peripherals/ledc/README.md
+++ b/examples/peripherals/ledc/README.md
@@ -1,30 +1,69 @@
-# LEDC (LED PWM Controller) Example
+# _LEDC Example_
+
+(See the README.md file in the upper level 'examples' directory for more information about examples.)
 
 This example shows how to control intensity of LEDs using ESP32's on-board hardware LED PWM Controller module.
 
-## Functionality
+## How to use example
+
+### Hardware Required
 
-Operations performed by example:
+* A development board with ESP32 SoC (e.g., ESP32-DevKitC, ESP-WROVER-KIT, etc.)
+* A USB cable for power supply and programming
 
-* Configuration of two timers (one high speed and the other low speed) that will be clocking four LEDC channels.
+Connect four LEDs to the following LEDC channels / individual GPIOs:
 
-* Configuration of four channels of LEDC module, two channels will operate in high speed mode and two in low speed mode. Each channel will drive one GPIO / LED.
+|ledc channel|GPIO|
+|:---:|:---:|
+|channel 0|GPIO18|
+|channel 1|GPIO19|
+|channel 2|GPIO4|
+|channel 3|GPIO5|
 
-* Initialization of fade service to fade / gradually change intensity of LEDs.
+### Configure the project
 
-* Operation of channels in a loop by cycling through four steps that will drive LEDs as follows:
+```
+make menuconfig
+```
 
-  1. Fade up / increase intensity
-  2. Fade down / decrease intensity (down to zero)
-  3. Set steady intensity
-  4. Set intensity to zero
+* Set serial port under Serial Flasher Options.
 
-## Hardware Setup
+### Build and Flash
 
-Connect four LEDs to the following LEDC channels / individual GPIOs:
+Build the project and flash it to the board, then run monitor tool to view serial output:
+
+```
+make -j4 flash monitor
+```
+
+(To exit the serial monitor, type ``Ctrl-]``.)
+
+See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.
+
+## Example Output
+
+Running this example, you will see each ledc's brightness changes differently
+
+* LEDC 1: Fade up / increase intensity
+* LEDC 2: Fade down / decrease intensity
+* LEDC 3: Keep a stable intensity
+* LEDC 4: LED is not on
+
+you can also see the following output log on the serial monitor:
+
+```
+1. LEDC fade up to duty = 4000
+2. LEDC fade down to duty = 0
+3. LEDC set duty = 4000 without fade
+4. LEDC set duty = 0 without fade
+...
+```
+
+## Troubleshooting
+
+* Programming fail
 
-  * Channel 0 - GPIO18
-  * Channel 1 - GPIO19
-  * Channel 2 - GPIO4
-  * Channel 3 - GPIO5
+    * Hardware connection is not correct: run `make monitor`, and reboot your board to see if there are any output logs.
+    * The baud rate for downloading is too high: lower your baud rate in the `menuconfig` menu, and try again.
 
+For any technical queries, please open an [issue] (https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon.
diff --git a/examples/peripherals/ledc/main/ledc_example_main.c b/examples/peripherals/ledc/main/ledc_example_main.c
index eadbf143f1..d61e73fba6 100644
--- a/examples/peripherals/ledc/main/ledc_example_main.c
+++ b/examples/peripherals/ledc/main/ledc_example_main.c
@@ -92,6 +92,7 @@ void app_main()
             .duty       = 0,
             .gpio_num   = LEDC_HS_CH0_GPIO,
             .speed_mode = LEDC_HS_MODE,
+            .hpoint     = 0,
             .timer_sel  = LEDC_HS_TIMER
         },
         {
@@ -99,6 +100,7 @@ void app_main()
             .duty       = 0,
             .gpio_num   = LEDC_HS_CH1_GPIO,
             .speed_mode = LEDC_HS_MODE,
+            .hpoint     = 0,
             .timer_sel  = LEDC_HS_TIMER
         },
         {
@@ -106,6 +108,7 @@ void app_main()
             .duty       = 0,
             .gpio_num   = LEDC_LS_CH2_GPIO,
             .speed_mode = LEDC_LS_MODE,
+            .hpoint     = 0,
             .timer_sel  = LEDC_LS_TIMER
         },
         {
@@ -113,6 +116,7 @@ void app_main()
             .duty       = 0,
             .gpio_num   = LEDC_LS_CH3_GPIO,
             .speed_mode = LEDC_LS_MODE,
+            .hpoint     = 0,
             .timer_sel  = LEDC_LS_TIMER
         },
     };