tests: Add a testcase for machine.PinBase class.
This commit is contained in:
parent
b2641b53e0
commit
119b3dabf7
|
@ -0,0 +1,25 @@
|
|||
try:
|
||||
from umachine import PinBase
|
||||
except ImportError:
|
||||
from machine import PinBase
|
||||
|
||||
|
||||
class MyPin(PinBase):
|
||||
|
||||
def __init__(self):
|
||||
print("__init__")
|
||||
self.v = False
|
||||
|
||||
def value(self, v=None):
|
||||
print("value:", v)
|
||||
if v is None:
|
||||
self.v = not self.v
|
||||
return int(self.v)
|
||||
|
||||
p = MyPin()
|
||||
|
||||
print(p.value())
|
||||
print(p.value())
|
||||
print(p.value())
|
||||
p.value(1)
|
||||
p.value(0)
|
|
@ -0,0 +1,9 @@
|
|||
__init__
|
||||
value: None
|
||||
1
|
||||
value: None
|
||||
0
|
||||
value: None
|
||||
1
|
||||
value: 1
|
||||
value: 0
|
Loading…
Reference in New Issue