mirror of
https://github.com/micropython/micropython.git
synced 2026-01-04 19:20:22 +01:00
cc3200: Re-work Pin class according to the new API.
Also add relevant test.
This commit is contained in:
@@ -28,14 +28,15 @@ See :ref:`pyb.Pin <pyb.Pin>`. ::
|
||||
from pyb import Pin
|
||||
|
||||
# initialize GP2 in gpio mode (af=0) and make it an output
|
||||
p_out = Pin('GP2', af=0, mode=Pin.OUT)
|
||||
p_out = Pin('GP2', mode=Pin.OUT)
|
||||
p_out.high()
|
||||
p_out.low()
|
||||
p_out.toggle()
|
||||
p_out(True)
|
||||
|
||||
# make GP1 an input with the pull-up enabled
|
||||
p_in = Pin('GP1', af = 0, mode=Pin.IN, type = Pin.STD_PU)
|
||||
p_in.value() # get value, 0 or 1
|
||||
p_in = Pin('GP1', mode=Pin.IN, pull = Pin.PULL_UP)
|
||||
p_in() # get value, 0 or 1
|
||||
|
||||
Timers
|
||||
------
|
||||
|
||||
Reference in New Issue
Block a user