WT32-ETH01 ethernet stop working after adding some pinMode function

I don't use loop() when I write code for an ESP32. Not sure what loops()'s issue is but I, for sure, know that the code I wrote will cause the gpio pins to switch states.

So how are you suggesting writing the code?
I have so the people code in VSCode and using another function, it could be that ESP32 is not fully supporting Arduino IDE?

I doubt that.

I've no more suggestions for you. The code I wrote works to switch a pin from high to low repeatedly. That the LED does not light up and down is another issue that remains to be solved. I know my code using the ESP32's API works. How you wired up the LED and the rest of the circuit is an unknown to me. Good luck.

isn't that supposed to be

// if you are using pins 16,18 and 19 then you need something like

// const byte led1 = 12;      // IO12 == 16
// const byte led2 = 4;       // IO4 == 18
// conts byte led3 = 2;      // IO2 == 19

const byte led = 2;  // 2 == GPIO2

void setup() {
  Serial.begin(115200);
  pinMode(led, OUTPUT);

  Serial.println("Started.");
}

void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);   // wait for a second                 
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);  
}

and what board type do you select under Menu > Tools > Boards ?

1 Like

seems to be working!!
the pin are not the pin number but the number that come after the IO,

Thanks!

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