stmhal: Add .value() method to Switch object, to mirror Pin and Signal.

This commit is contained in:
Damien George
2017-06-15 17:34:51 +10:00
parent 4abe3731e3
commit fd860dc552
3 changed files with 20 additions and 2 deletions

View File

@@ -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
----------------