aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/lang/api/digitalread.rst
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-04-26 03:27:10 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2011-04-26 03:27:10 -0400
commit1f98566c939c84a986ee8b60fde6aa601c3521da (patch)
tree8a0069ca9758bf6f3952bd71bf1a7c149d161bc1 /docs/source/lang/api/digitalread.rst
parent621706150fc55b8266229131cc7fb6db6b2f7cd9 (diff)
downloadlibrambutan-1f98566c939c84a986ee8b60fde6aa601c3521da.tar.gz
librambutan-1f98566c939c84a986ee8b60fde6aa601c3521da.zip
0.0.10 Documentation checkpoint.
The vast majority of the Maple-specific values have been pulled out of the higher-level overview pages and replaced with refs into documents under /docs/source/hardware/. Much of the work that's left to be done in this regard is labeled with versioned TODO and FIXME comments. Suggestions from StephenFromNYC and gbulmer were incorporated from this forum thread: http://forums.leaflabs.com/topic.php?id=703
Diffstat (limited to 'docs/source/lang/api/digitalread.rst')
-rw-r--r--docs/source/lang/api/digitalread.rst39
1 files changed, 16 insertions, 23 deletions
diff --git a/docs/source/lang/api/digitalread.rst b/docs/source/lang/api/digitalread.rst
index 3502587..ccf4a4c 100644
--- a/docs/source/lang/api/digitalread.rst
+++ b/docs/source/lang/api/digitalread.rst
@@ -8,51 +8,44 @@ digitalRead()
Reads the value from a specified digital pin, either :ref:`HIGH
<lang-constants-high>` or :ref:`LOW <lang-constants-low>`.
-
Library Documentation
---------------------
.. doxygenfunction:: digitalRead
+Discussion
+----------
+
+If the pin isn't connected to anything, ``digitalRead()`` can return
+either HIGH or LOW (and this will change in a way that seems random).
Example
-------
-The following example turns the LED on when the button is pressed::
-
- int ledPin = 13; // LED connected to Maple pin 13
- int buttonPin = 38; // BUT connected to Maple pin 38
+The following example turns the LED on or off when the button is pressed::
void setup() {
- pinMode(ledPin, OUTPUT);
- pinMode(buttonPin, INPUT);
+ pinMode(BOARD_LED_PIN, OUTPUT);
+ pinMode(BOARD_BUTTON_PIN, INPUT);
}
void loop() {
- int val = digitalRead(buttonPin); // reads the input pin
- digitalWrite(ledPin, val);
+ int val = digitalRead(BOARD_BUTTON_PIN); // reads the input pin
+ togglePin(BOARD_LED_PIN, val);
}
-Note
-----
-
-If the pin isn't connected to anything, ``digitalRead()`` can return
-either HIGH or LOW (and this can change in a way that seems random).
-
Arduino Compatibility
---------------------
The Maple version of ``digitalRead()`` is compatible with Arduino.
-
See Also
--------
-- :ref:`pinMode <lang-pinMode>`
-- :ref:`digitalWrite <lang-digitalWrite>`
-
-
-
-
+- :ref:`BOARD_BUTTON_PIN <lang-board-values-but>`
+- :ref:`lang-isButtonPressed`
+- :ref:`lang-pinmode`
+- :ref:`lang-digitalWrite`
+- :ref:`lang-togglepin`
-.. include:: cc-attribution.txt
+.. include:: /arduino-cc-attribution.txt