Skip to content

In Freertos Timer use show(), the Timer will not working. #449

@YuaXan

Description

@YuaXan

Chip type: ESP32-C3
ESP-IDF version: V5.3.4
Arduino version: v3.1.4

I created a timer for RGB blinking.

void LED_Blink_Timer_Callback(TimerHandle_t xTimer)
{
    Serial.println("LED_Blink_Timer_Callback 0");
    if (!is_led_blinking)
        return;

    if (ledState)                                     // Check if LED blinking is enabled
        strip.setPixelColor(0, strip.Color(0, 0, 0)); // Turn off the NeoPixel
    else
        strip.setPixelColor(0, led_blink_color);
    Serial.println("LED_Blink_Timer_Callback 1");
    strip.show();
    Serial.println("LED_Blink_Timer_Callback 2");
    ledState = !ledState; // Toggle the LED state
}
void LED_Init(void)
{
    // Initialize NeoPixel strip
    strip.begin();            // Set up the NeoPixel strip
    strip.setBrightness(255); // Set initial brightness (0-255)
    strip.show();             // Initialize the NeoPixel strip

    led_blink_timer = xTimerCreate("LED_Blink_Timer", pdMS_TO_TICKS(500), pdTRUE, NULL, LED_Blink_Timer_Callback); // Create a timer for blinking
    xTimerStart(led_blink_timer, 0);
}

When the code runs to strip.show(), the timer can't keep working.

But I try to use the task to run, that's not problem.

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