I'm facing an issue with blinking the onboard RGB LED on my ESP32-C3-devKitM-1 board. According to the ESP32-C3 guide, the RGB LED is connected to GPIO 8. Although I can successfully make the LED blink using Arduino programming, I'm unable to achieve the same result when using C programming with the idf.py and ESP-IDF Framework. The RGB LED remains unresponsive.
Arduino code:
- void setup() {
- pinMode(LED_BUILTIN, OUTPUT);
- }
- void loop() {
- digitalWrite(LED_BUILTIN, HIGH);
- delay(1000);
- digitalWrite(LED_BUILTIN, LOW);
- delay(1000);
- }
- #define LED_PIN GPIO_NUM_8
- void app_main(void){
- gpio_reset_pin(LED_PIN);
- gpio_set_direction(LED_PIN, GPIO_MODE_OUTPUT_OD);
- while (1){
- gpio_set_level(LED_PIN,1);
- vTaskDelay(1000/portTICK_PERIOD_MS);
- gpio_set_level(LED_PIN,0);
- vTaskDelay(1000/portTICK_PERIOD_MS);
- }
- }
Why is the RGB LED on my ESP32-C3-devKitM-1 board not blinking when I program it using the C programming language and the ESP-IDF Framework, despite being able to successfully achieve the blinking functionality using Arduino?