Skip to content

Vue example: LED colour never updates on ESP32 #73

Description

@davidchatting-bot

Where

`updateLEDColourRGB()` in `examples/Vue/Vue.ino`:
```cpp
void updateLEDColourRGB() {
#if defined(ESP8266)
analogWrite(LED_RED_PIN, red);
analogWrite(LED_GREEN_PIN, green);
analogWrite(LED_BLUE_PIN, blue);

#elif defined(ESP32)
//TODO: analogWrite is not defined for ESP32

#endif
}
```

Problem

The whole point of this example is a colour-picker UI driving an RGB LED, but on ESP32 the function body for that platform is empty - the colour value is received and stored (`red`/`green`/`blue` globals get set in `onYoYoMessagePOST()`) but nothing ever gets written to the LED pins on ESP32.

Ask

Use the ESP32 LEDC PWM API (`ledcSetup`/`ledcAttachPin`/`ledcWrite`, or `analogWrite`'s ESP32-Arduino-core equivalent depending on which core version this targets - newer arduino-esp32 cores did add a compatibility `analogWrite`) to drive `LED_RED_PIN`/`LED_GREEN_PIN`/`LED_BLUE_PIN` on ESP32 the same way the ESP8266 branch does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions