2016-06-19 12:45:29 -04:00
|
|
|
try:
|
2019-04-28 08:12:17 -04:00
|
|
|
try:
|
|
|
|
import umachine as machine
|
|
|
|
except ImportError:
|
|
|
|
import machine
|
2016-07-17 09:30:24 -04:00
|
|
|
machine.PinBase
|
2019-04-28 08:12:17 -04:00
|
|
|
except:
|
2016-07-17 09:30:24 -04:00
|
|
|
print("SKIP")
|
2017-06-10 13:14:16 -04:00
|
|
|
raise SystemExit
|
2016-06-19 12:45:29 -04:00
|
|
|
|
|
|
|
|
2016-07-17 09:30:24 -04:00
|
|
|
class MyPin(machine.PinBase):
|
2016-06-19 12:45:29 -04:00
|
|
|
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)
|
|
|
|
|
2020-03-22 22:26:08 -04:00
|
|
|
|
2016-06-19 12:45:29 -04:00
|
|
|
p = MyPin()
|
|
|
|
|
|
|
|
print(p.value())
|
|
|
|
print(p.value())
|
|
|
|
print(p.value())
|
|
|
|
p.value(1)
|
|
|
|
p.value(0)
|