• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Tri-state / Hight Impedance ESP8266 GPIO (MicroPython) – Solution use: Pin.OPEN_DRAIN

Q&A Forum › Tri-state / Hight Impedance ESP8266 GPIO (MicroPython) – Solution use: Pin.OPEN_DRAIN
0 Vote Up Vote Down
Gary asked 3 years ago

Hi Sara, et all,
Can I change an ESP8266 pin dynamically (MicroPython)
Any code examples appreciated.
Gary

6 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
What do you mean by dinamically?
Regards,
Sara

0 Vote Up Vote Down
Gary answered 3 years ago

In a python script can I set a a GPIO as output then ie to set a pin high, and then imedially after set the same pin back to input?
 
This would be like a
Tri-state

0 Vote Up Vote Down
Gary answered 3 years ago

Or can I use a GPIO as a
Tri-state

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
Yes, I think you can do that.
Check the documentation here: https://docs.micropython.org/en/latest/library/machine.Pin.html
See the example “usage model” and take a look at p0 that is first declared as an output, and then it is changed to an input.
Regards,
Sara

0 Vote Up Vote Down
Gary answered 3 years ago

Thanks looks good – from your ref:

  • Pin.OPEN_DRAIN – If the value is ‘0’ the pin is set to a low voltage state. Otherwise the pin is set to high-impedance state.
0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Great!
I’m glad you found a solution.
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.