I’ve just started your book on Micropython with the ESP32/8622 (really great book thanks very much!!).
You mention that the ESPs have internal pullup/down resisters that you can use with the Pin object.
In your LED and button examples you use resistors in the circuits . Could you use the ESPs internal resistors instead ?
I’m glad you’re enjoying our MicroPython book.
Yes, you can use the internal resistors instead of the 10kOhm resistor on the pushbutton.
In our example, just remove the resistor from the circuit, and set the pushbutton with an internal pull_down resistor as follows:
button = Pin(4, Pin.IN, Pin.PULL_DOWN)
I hope this answers your question.
I don’t recommend setting internal PULL_UP or PULL_DOWN resistors on the strapping pins (which includes GPIO4) because they may prevent your ESP go into upload/flashing mode and you may have trouble uploading new code to your ESP32.
Here are the strapping pins you should avoid setting the pull_up and pull_down resistors:
- GPIO 0
- GPIO 2
- GPIO 4
- GPIO 5
- GPIO 12
- GPIO 15
You can use pull_up and pull_down resistors on other pins without any problems.
Thanks for the explanation Sara – much appreciated.
Again, thank you for the excellent book (and all the other resources you guys provide) – keep up the great work!