Skip to content

Commit

Permalink
Updated doc for PWM upcoming changes in Arduino core 3
Browse files Browse the repository at this point in the history
  • Loading branch information
rzeldent committed Dec 7, 2023
1 parent 182063b commit b196771
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,21 @@ Example:
Set PWM channel 0 to 5000Hz with a resolution of 8 bits (256 levels) and attach it to the red LED.
Next, set the level to 25%. This is 192 (256 - 25%) because of the inverted output.
ESP_ARDUINO_VERSION_MAJOR < 3:
```c++
ledcSetup(0, 5000, 8);
ledcAttachPin(LED_PIN_R, 0);
ledcWrite(0, 192);
```

ESP_ARDUINO_VERSION_MAJOR >= 3

```c++
ledcAttach(LED_PIN_R, 0, 8);
ledcWrite(LED_PIN_R, 192);
```
## Reading the light sensor (CDS)
If the board has a light sensor, the define ```HAS_LIGHTSENSOR``` is defined.
Expand Down

0 comments on commit b196771

Please sign in to comment.