Code will not upload to ESP8266

Hello,

I'm having some difficulties with the uploading code to a ESP8266 from the Arduino IDE. It seems to recognise the board without issue but does not do anything after printing "Leaving... Hard resetting via RTS pin...". I cannot find a solution to this online but some suggest it could be a problem with the memory. I'm running a very simple program to test the ESP8266, seen below. Also I'm not sure if this has any significance but when I plugged in this ESP8266 for the first time the blue LED would stay on while powered but once I tried to upload a code the LED stays off unless it's compiling code before attempting to upload it. The board I have selected in Arduino is the NodeMCU 1.0 (ESP-12E Module). below is also the output, any help would be much appreciated. I would just like to know if there is something wrong with the board and if I should replace it?

. Variables and constants in RAM (global, static), used 28188 / 80192 bytes (35%)
║   SEGMENT  BYTES    DESCRIPTION
╠══ DATA     1496     initialized variables
╠══ RODATA   932      constants       
╚══ BSS      25760    zeroed variables
. Instruction RAM (IRAM_ATTR, ICACHE_RAM_ATTR), used 60347 / 65536 bytes (92%)
║   SEGMENT  BYTES    DESCRIPTION
╠══ ICACHE   32768    reserved space for flash instruction cache
╚══ IRAM     27579    code in IRAM    
. Code in flash (default, ICACHE_FLASH_ATTR), used 241572 / 1048576 bytes (23%)
║   SEGMENT  BYTES    DESCRIPTION
╚══ IROM     241572   code in flash   
esptool.py v3.0
Serial port COM4
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 58:bf:25:d9:b4:03
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 275728 bytes to 202296...
Writing at 0x00000000... (7 %)
Writing at 0x00004000... (15 %)
Writing at 0x00008000... (23 %)
Writing at 0x0000c000... (30 %)
Writing at 0x00010000... (38 %)
Writing at 0x00014000... (46 %)
Writing at 0x00018000... (53 %)
Writing at 0x0001c000... (61 %)
Writing at 0x00020000... (69 %)
Writing at 0x00024000... (76 %)
Writing at 0x00028000... (84 %)
Writing at 0x0002c000... (92 %)
Writing at 0x00030000... (100 %)
Wrote 275728 bytes (202296 compressed) at 0x00000000 in 17.8 seconds (effective 123.8 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

// Define the GPIO pin for the LED
const int ledPin = D2;

void setup() {
  // Start Serial communication
  Serial.begin(9600);

  // Set the LED pin as an output
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // Blink the LED
  digitalWrite(ledPin, HIGH); // Turn the LED on
  delay(1000);                 // Wait for 1 second
  digitalWrite(ledPin, LOW);  // Turn the LED off
  delay(1000);                 // Wait for 1 second
  printf("done");
}

printf() does not work directly
try

Serial.printf("done");

or

Serial.println("done");
// Define the GPIO pin for the LED
const int ledPin = D2;

On a nodeMCU the builtin LED is on GPIO 2, not D2 (GPIO 4)
try

// Define the GPIO pin for the LED
const int ledPin = 2;

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.