diff options
author | Damien George <damien.p.george@gmail.com> | 2017-06-15 17:34:51 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-06-15 17:34:51 +1000 |
commit | fd860dc552b2ec53df8c6ce7e1245206719d469b (patch) | |
tree | f0e1fa830f923ebc76d8815c4a30772853696219 /docs/pyboard | |
parent | 4abe3731e3fbce88c2efa265950c5e13b30426d6 (diff) | |
download | micropython-fd860dc552b2ec53df8c6ce7e1245206719d469b.tar.gz micropython-fd860dc552b2ec53df8c6ce7e1245206719d469b.zip |
stmhal: Add .value() method to Switch object, to mirror Pin and Signal.
Diffstat (limited to 'docs/pyboard')
-rw-r--r-- | docs/pyboard/tutorial/switch.rst | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/docs/pyboard/tutorial/switch.rst b/docs/pyboard/tutorial/switch.rst index 945e89aa05..91683fba45 100644 --- a/docs/pyboard/tutorial/switch.rst +++ b/docs/pyboard/tutorial/switch.rst @@ -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 ---------------- |