docs/esp8266: Consistently replace Pin.high/low methods with .on/off.
This commit is contained in:
parent
d5b8825d5f
commit
272a5d95e0
@ -107,8 +107,8 @@ Use the :ref:`machine.Pin <machine.Pin>` class::
|
|||||||
from machine import Pin
|
from machine import Pin
|
||||||
|
|
||||||
p0 = Pin(0, Pin.OUT) # create output pin on GPIO0
|
p0 = Pin(0, Pin.OUT) # create output pin on GPIO0
|
||||||
p0.high() # set pin to high
|
p0.on() # turn on pin, set to high
|
||||||
p0.low() # set pin to low
|
p0.off() # turn off pin, set to low
|
||||||
p0.value(1) # set pin to high
|
p0.value(1) # set pin to high
|
||||||
|
|
||||||
p2 = Pin(2, Pin.IN) # create input pin on GPIO2
|
p2 = Pin(2, Pin.IN) # create input pin on GPIO2
|
||||||
|
@ -35,8 +35,8 @@ Then set its value using::
|
|||||||
|
|
||||||
Or::
|
Or::
|
||||||
|
|
||||||
>>> pin.low()
|
>>> pin.off()
|
||||||
>>> pin.high()
|
>>> pin.on()
|
||||||
|
|
||||||
External interrupts
|
External interrupts
|
||||||
-------------------
|
-------------------
|
||||||
|
@ -101,11 +101,12 @@ turn it on and off using the following code::
|
|||||||
|
|
||||||
>>> import machine
|
>>> import machine
|
||||||
>>> pin = machine.Pin(2, machine.Pin.OUT)
|
>>> pin = machine.Pin(2, machine.Pin.OUT)
|
||||||
>>> pin.high()
|
>>> pin.on()
|
||||||
>>> pin.low()
|
>>> pin.off()
|
||||||
|
|
||||||
Note that ``high`` might turn the LED off and ``low`` might turn it on (or vice
|
Note that ``on`` method of a Pin might turn the LED off and ``off`` might
|
||||||
versa), depending on how the LED is wired on your board.
|
turn it on (or vice versa), depending on how the LED is wired on your board.
|
||||||
|
To resolve this, machine.Signal class is provided.
|
||||||
|
|
||||||
Line editing
|
Line editing
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
Loading…
x
Reference in New Issue
Block a user