So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By aledrus
#73662 Hello everyone. I have a very noob question and I need your help.

I want to write to the ESP a program that blinks in some random pattern, but I also want to monitor the number of blinks with serial monitor.

For example,

Code: Select allLet x be a random number
For (int i=0;i<x;i++) { digitalWrite(LED_builtin,0); delay(500); digitalWrite(LED_builtin,1); }
Serial.println (x);


How could I do something like this?

It seems that I can only use either the Serial Monitor or the blue LED, and I can't use both.

In most other responses to other people's questions, they suggest wiring up another LED instead. But this isn't the proper solution is it?

From my searches and reading, the Serial Monitor depends on the TX pin (GPIO3). And the LED is on GPIO0 (or GPIO2?). So technically they're independent lines, the TX for the Serial Monitor and the GPIO0 is for the blue LED. But this doesn't seem to be happening this way.

I have also read people suggesting "switch RX/TX". What does this mean exactly? Does it mean I set GPIO3 to input and set GPIO1 to output?

Will the Serial Monitor know to listen to GPIO1 for the serial debugging logs?

Thanks for reading!
User avatar
By aledrus
#73674 I've tried the serial.swap()
I don't think it did anything, I am still not seeing anything on the Serial Monitor when the digitalOutput is set to GPIO1.

I also tried the others, Serial1.begin, and also
Code: Select allSerial.begin(115200)
Serial.set_tx(2);


From what I understand, this sets the TX pin to GPIO2.
but still, the LED blinks fine but the Serial Monitor is not receiving anything on its display.

Maybe it's important to mention that I am using the CH340 USB adapter to connect the ESP to the USB ?
User avatar
By btidey
#73679 The ESP-01 has very limited access to the GPIO. The header pins are hard wired to RX,TX, GPIO01 so you can't swap serial lines around to the other pins like you can with other ESP modules.

You will have better luck using an ESP-12F or a nodemcu with built in usb which give full access to all the GPIO pins available on a esp8266