scope

Hi experts,
if I want to test my ESP8862 with a simple sketch:
#define LED D0
void setup(){
pinMode(LED, OUTPUT);
}

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

I get:
error: D0 was not declared in this scope.

If instead I use the Blink sketch from Examples/01.Basics
from the Arduino IDE I get a similar
error:LED_BUILTIN was not declared in this scope

D0 and LED_BUILTIN are defined in the core support files for some (but not all) ESP8266 boards.

So make sure you have the correct board selected in the IDE's Tools menu.

If you still get the errors, then you need to work out yourself which GPIO number your LED is connected to, and put that number in the #define statement.

on the esp32, you can specific gpio's directly, by gpio #

well, thank you..
I made shure now that the correct board was loaded.

but only with this altered sketch the Arduino IDE is
compiling:

void setup(){

sorry, the now compiling code is:

void setup(){
pinMode(2, OUTPUT);

void loop(){
digitalWrite(2, LOW);
delay(1000);
digitalWrite(2, HIGH);
delay(1000),

But if I try to load it I get:
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

If I try to load it while pressing the IO0. (Flash) button (Onboard LEDs? NodeMCU's got two! – Low voltage. Mostly harmless...) I get:
esptool.py v2.6
Serial port COM6
Connecting....
Chip is ESP32D0WDQ5 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: c8:2b:96:a1:3b:a0
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 8192 bytes to 47...
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 4369.0 kbit/s)...
Hash of data verified.
Compressed 15856 bytes to 10276...
Wrote 15856 bytes (10276 compressed) at 0x00001000 in 0.1 seconds (effective 968.3 kbit/s)...
Hash of data verified.
Compressed 207824 bytes to 105394...
Wrote 207824 bytes (105394 compressed) at 0x00010000 in 1.5 seconds (effective 1105.4 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 128...
Wrote 3072 bytes (128 compressed) at 0x00008000 in 0.0 seconds (effective 1536.0 kbit/s)...
Hash of data verified.

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

That code won’t compile. And didn’t you say you were using an ESP8266?

Anyway, the second set of messages says the upload all happened normally somehow.

well, sorry I'm working first time with microControlers.
I'am using a NodeMCU-32S-ESP32. My script above (Jul 06, 2020, 07:48 pm) did compile
but wouldn't load, producing the above posted error message.

But today, when I plugged in the microCotroler it executed the sketch blinking the inbuilt LED
respectively right away.
Upon opening the Arduino IDE I got a long message consisting mainly of file paths but with
one error message on last line:
<error downloading http://arduino.esp8266.com/stable/package_esp8266com_index.jso>
which most likely points to the problem: Download of wrong software, following a
tutorial which was based probably on a different microControler.

At present I just don't know from whre to get the appropriate s/w.
Can somebody tell me ?

luemar:
<error downloading http://arduino.esp8266.com/stable/package_esp8266com_index.jso>

That looks like a typo in the "Additional Boards Manager URLs" field in the IDE Preferences. It should end with .json, not .jso.

If you're working with both ESP8266 and ESP32 boards that field should say something like this:

https://arduino.esp8266.com/stable/package_esp8266com_index.json,https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

thanks for your patience.
But I still don't get it:
My microController setup is now certainly correct.

If I try to compile the sketch posted on Jul 06, 2020, 09:30 am I still get an
error saying D0 is not in the scope.....

If I plug in my NodeMCU-32S-ESP32 the sketch posted on Jul 06, 2020, 07:48 pm
runs. If I change the delay times inmy sketch and upload it a change of the
blinking sequence occurs, but not as programmed until an error messenge
appears:

after which the blinking mode falls back to it's original sketch.

luemar:
If I try to compile the sketch posted on Jul 06, 2020, 09:30 am I still get an
error saying D0 is not in the scope.....

D0 is not a valid pin number on the ESP32 NodeMCU board you're using. I think we established you need to use pin 2 instead.

If I plug in my NodeMCU-32S-ESP32 the sketch posted on Jul 06, 2020, 07:48 pm
runs. If I change the delay times inmy sketch and upload it a change of the
blinking sequence occurs, but not as programmed until an error messenge
appears:

after which the blinking mode falls back to it's original sketch.

OK let's take this step by step - show us the exact code you're trying to upload, and then show us the full error message you get when you try.

thanks for your patience.
I got a few steps further:

When I press the EN button while holding the BOOT button teh LED stops blinking
and the ESP32 is readi for upload.

I then upload a slightly altered sketch:

const int LED = 2;
void setup() {
pinMode(LED, OUTPUT);
Serial.begin(115200);
}

void loop() {
Serial.println(“Hallo, ESP32”);
digitalWrite(LED, HIGH);
delay(100);
digitalWrite(LED, LOW);
delay(1000);
}

which intially executes, but no print statement appears on the serial monitor,
while in the appearing message (see below) the line <Connecting........______..... .....> runs.
Once tha last line appears < A fatal error ocurred....> the blinking mode changes to a regular
blinking according to the sketch I loaded the first time on the ESP32:

void setup() {
pinMode(2, OUTPUT);
}

void loop() {
digitalWrite(2, LOW);
delay(1000);
digitalWrite(2, HIGH);
delay(1000);
}

The error message appearing attached.

error message.txt (31.1 KB)

I figured it out finally:
after connecting a 10microF capacitator to the EN and GND pins
the uploading is working fine.