summaryrefslogtreecommitdiff
path: root/tests/extmod/machine_pinbase.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/extmod/machine_pinbase.py')
-rw-r--r--tests/extmod/machine_pinbase.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/extmod/machine_pinbase.py b/tests/extmod/machine_pinbase.py
new file mode 100644
index 000000000..07a489a59
--- /dev/null
+++ b/tests/extmod/machine_pinbase.py
@@ -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)