mirror of
https://github.com/micropython/micropython.git
synced 2026-01-04 19:20:22 +01:00
stmhal: Add .value() method to Switch object, to mirror Pin and Signal.
This commit is contained in:
@@ -15,12 +15,18 @@ the name ``pyb`` does not exist.
|
||||
|
||||
With the switch object you can get its status::
|
||||
|
||||
>>> sw()
|
||||
>>> sw.value()
|
||||
False
|
||||
|
||||
This will print ``False`` if the switch is not held, or ``True`` if it is held.
|
||||
Try holding the USR switch down while running the above command.
|
||||
|
||||
There is also a shorthand notation to get the switch status, by "calling" the
|
||||
switch object::
|
||||
|
||||
>>> sw()
|
||||
False
|
||||
|
||||
Switch callbacks
|
||||
----------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user