Haii
I want a certain pin of ESP8266 to be enable for some time and after that certain time it should be disabled and other pin should be enabled.
While one is enabled the other should be disabled.
How can we implement this using MicroPython Code?
Thanks
how to enable and disable two different pins in esp 8266
-
- Posts: 1
- Joined: Wed Oct 26, 2016 9:49 am
Re: how to enable and disable two different pins in esp 8266
Yes that should be pretty straightforward. Something like the following will flip the value of two pins before waiting five seconds to do it again.
Code: Select all
import time
from machine import Pin
pin_a = Pin(4, Pin.OUT)
pin_b = Pin(5, Pin.OUT)
while True:
pin_a.value(1)
pin_b.value(0)
time.sleep(5)
pin_a.value(0)
pin_b.value(1)
time.sleep(5)