Search code examples
c++arduinoesp32platformio

ESP32 DevKitC Development on board LED blinking unintentionally


I wanted to create a simple HelloWorld program with my new ESP32 DevKitC Development module but I am confused that my LED is blinking even though I don't specify it in the program.

My code:

#include <Arduino.h>

#define LED 2

int i = 0;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  pinMode(LED, OUTPUT);  
  digitalWrite(LED, LOW);
}

void loop() {
  i++;
  Serial.print("I am running and calculating:"); Serial.println(i);
  delay(1000);
}

My environment:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200

I can see in my terminal the Serial.print output with the correct i values:

enter image description here

  • But the on board LED is still blinking even though on line 11 I specifically set the pin to LOW.

  • Strange thing is that the LED is blinking perfectly in sync with the Serial.print output.

  • I am using VS code with PlatformIO, I have tried erasing the flash, rebuilding the program, cleaning it, uploading and nothin helped (even tried the verbose build and verbose upload).

What can be the cause of this?


Solution

  • There are two LEDs which blink whenever there's UART traffic in either direction. You can't control them.