0

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?

1
  • 2
    There are different versions of DevKitC. Which version do you have? I have V4 and it only has one LED, which represents 5V power being on. It does not have an onboard LED that I can program. As Tarmo indicates in his answer, some boards have an LED connected to the serial port tx and/or rx. So that's likely what you're seeing. Commented Oct 8, 2021 at 11:22

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! That was the case :) silly of me :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.