micropython/tests/extmod/machine_pinbase.py
Jim Mussared 4216bc7d13 tests: Replace umodule with module everywhere.
This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08 17:54:24 +10:00

29 lines
427 B
Python

try:
import machine
machine.PinBase
except:
print("SKIP")
raise SystemExit
class MyPin(machine.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)