summaryrefslogtreecommitdiffstatshomepage
path: root/tests/extmod/machine_pinbase.py
blob: 07a489a596254fef07b8759e3e90ab91821cae37 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)