ESP8266EX with Ardunio IDE does'nt do what the sketch say

Viewed 67

My Sketch:

int LED = 9;

void setup(){
   pinMode(LED, OUPUT);
}

void loop() {
   digitalWrie(LED, HIGH);
   delay(500);
   digitalWrite(LED, LOW);
   delay(500);
}

My USB cable transmit power and data. Ardunio IDE version: 1.8.19 My OS: Ubuntu 20.04 (focal) running with gnome. And here is how I connected the LED to Wire 9. enter image description here

Error message when I do cmd+r:

Executable segment sizes: ICACHE : 32768 - flash instruction cache IROM : 231756 - code in flash (default or ICACHE_FLASH_ATTR) IRAM : 26793 / 32768 - code in IRAM (IRAM_ATTR, ISRs...) DATA : 1500 ) - initialized variables (global, static) in RAM/HEAP RODATA : 876 ) / 81920 - constants (global, static) in RAM/HEAP BSS : 25608 ) - zeroed variables (global, static) in RAM/HEAP Sketch uses 260925 bytes (24%) of program storage space. Maximum is 1044464 bytes. Global variables use 27984 bytes (34%) of dynamic memory, leaving 53936 bytes for local variables. Maximum is 81920 bytes.

And error message when I do cmd+u:

esptool.py v3.0 Serial port /dev/ttyUSB0 Connecting.... Chip is ESP8266EX Features: WiFi Crystal is 26MHz MAC: 48:55:19:00:98:3e Uploading stub... Running stub... Stub running... Changing baud rate to 460800 Changed. Configuring flash size... Auto-detected Flash size: 4MB Compressed 265072 bytes to 195102... Writing at 0x00000000... (8 %) Writing at 0x00004000... (16 %) Writing at 0x00008000... (25 %) Writing at 0x0000c000... (33 %) Writing at 0x00010000... (41 %) Writing at 0x00014000... (50 %) Writing at 0x00018000... (58 %) Writing at 0x0001c000... (66 %) Writing at 0x00020000... (75 %) Writing at 0x00024000... (83 %) Writing at 0x00028000... (91 %) Writing at 0x0002c000... (100 %) Wrote 265072 bytes (195102 compressed) at 0x00000000 in 4.8 seconds (effective 438.2 kbit/s)... Hash of data verified. Leaving... Hard resetting via RTS pin...

I googeld at first everything and everything seems to be normal. So the error messages are (maybe) not error messages. Now I'm expecting that the LED goes on for 5 sec. on and goes off for 5 sec. But what it does (how ever I change the sketch) it goes for a short time on and then it it blink every ten sec. for a very short time (half sec.)

1 Answers

You can not use pin 9 on the ESP8266 D1, because this pin is used by flash memory. Using pin 9 resets the board over and over again. To check use pin 13 or D7. WeMos boards have a different pin notation than other Arduino boards. D0 = 16, D1 = 5, D2 = 4, D3 = 0,D4 = 2, D5 = 14, D6 = 12,D7 = 13, D8 = 15, RX = 3, TX = 1.

int LED = 13;

   // the setup function runs once when you press reset or power the board
void setup() {
    Serial.begin(9600); 
    while (!Serial);//needed for some boards, doesn't hurt
    delay(1000); //a delay, sometimes needed to print messages from setup
    const char compile_dateAndTime[] = __DATE__ " " __TIME__;//date and time from compiler
    Serial.print("Uploaded on : ");
    Serial.println(compile_dateAndTime);
    Serial.println("");
    Serial.println("Setup done");
    Serial.println("");
    pinMode(LED, OUTPUT);
}

// the loop function runs over and over again until power down or reset
void loop() {
    digitalWrite(LED, HIGH);
    delay(500);
    digitalWrite(LED, LOW);
    delay(500);  
}
Related