From fd860dc552b2ec53df8c6ce7e1245206719d469b Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 15 Jun 2017 17:34:51 +1000 Subject: stmhal: Add .value() method to Switch object, to mirror Pin and Signal. --- docs/pyboard/tutorial/switch.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'docs/pyboard/tutorial/switch.rst') 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 ---------------- -- cgit v1.2.3