tests, pyb: Update pin test.

This commit is contained in:
Damien George 2014-08-08 22:38:58 +01:00
parent 284efa89ae
commit b92e7533d3
2 changed files with 10 additions and 4 deletions

View File

@ -1,17 +1,21 @@
from pyb import Pin
p = Pin('X1')
p = Pin('X1', Pin.IN)
print(p)
print(p.name())
print(p.pin())
print(p.port())
p = Pin('X1', Pin.IN, Pin.PULL_UP)
#p = Pin('X1', Pin.IN, pull=Pin.PULL_UP)
p = Pin('X1', Pin.IN, pull=Pin.PULL_UP)
p = Pin('X1', mode=Pin.IN, pull=Pin.PULL_UP)
print(p)
print(p.value())
p.init(p.IN, p.PULL_DOWN)
#p.init(p.IN, pull=p.PULL_DOWN)
p.init(p.IN, pull=p.PULL_DOWN)
p.init(mode=p.IN, pull=p.PULL_DOWN)
print(p)
print(p.value())
p.init(p.OUT_PP)

View File

@ -1,8 +1,10 @@
<Pin A0>
Pin(Pin.cpu.A0, mode=Pin.IN)
A0
0
0
Pin(Pin.cpu.A0, mode=Pin.IN, pull=Pin.PULL_UP)
1
Pin(Pin.cpu.A0, mode=Pin.IN, pull=Pin.PULL_DOWN)
0
0
1