summaryrefslogtreecommitdiffstatshomepage
path: root/docs/library/pyb.Switch.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/library/pyb.Switch.rst')
-rw-r--r--docs/library/pyb.Switch.rst7
1 files changed, 6 insertions, 1 deletions
diff --git a/docs/library/pyb.Switch.rst b/docs/library/pyb.Switch.rst
index bc62b6eee9..0d5dc63b74 100644
--- a/docs/library/pyb.Switch.rst
+++ b/docs/library/pyb.Switch.rst
@@ -8,7 +8,8 @@ A Switch object is used to control a push-button switch.
Usage::
sw = pyb.Switch() # create a switch object
- sw() # get state (True if pressed, False otherwise)
+ sw.value() # get state (True if pressed, False otherwise)
+ sw() # shorthand notation to get the switch state
sw.callback(f) # register a callback to be called when the
# switch is pressed down
sw.callback(None) # remove the callback
@@ -34,6 +35,10 @@ Methods
Call switch object directly to get its state: ``True`` if pressed down,
``False`` otherwise.
+.. method:: Switch.value()
+
+ Get the switch state. Returns `True` if pressed down, otherwise `False`.
+
.. method:: Switch.callback(fun)
Register the given function to be called when the switch is pressed down.