aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-05-27 20:57:54 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2011-05-27 20:57:54 -0400
commit40ae21ac7d79197577ebfd324e2c9e266000e33a (patch)
treec7968f9a4e98bfc34f958d2e4bdc2534d616f726
parentb74f9add390ec4b6200fefd234a6a5c470c9d0d6 (diff)
downloadlibrambutan-40ae21ac7d79197577ebfd324e2c9e266000e33a.tar.gz
librambutan-40ae21ac7d79197577ebfd324e2c9e266000e33a.zip
Docs: Updating pinmode.rst
Convert to board-specific values; make the language friendlier.
-rw-r--r--source/lang/api/pinmode.rst47
1 files changed, 25 insertions, 22 deletions
diff --git a/source/lang/api/pinmode.rst b/source/lang/api/pinmode.rst
index 8cee3e5..643e26e 100644
--- a/source/lang/api/pinmode.rst
+++ b/source/lang/api/pinmode.rst
@@ -20,26 +20,29 @@ Library Documentation
Discussion
----------
-``pinMode()`` is usually called within :ref:`lang-setup` in order to
+pinMode() is usually called within :ref:`lang-setup` in order to
configure a pin for a certain usage (although it may be called
anywhere).
Example
-------
-::
+This example uses pinMode() to set up the pin connected to the
+built-in LED as an output. Once this is done,
+:ref:`lang-digitalwrite` can be used to turn the pin ``HIGH`` and
+``LOW``, which turn the LED on and off.
- int ledPin = 13; // LED connected to digital pin 13
+::
void setup() {
- pinMode(ledPin, OUTPUT); // sets the digital pin as output
+ pinMode(BOARD_LED_PIN, OUTPUT); // sets the LED pin as output
}
void loop() {
- digitalWrite(ledPin, HIGH); // sets the LED on
- delay(1000); // waits for a second
- digitalWrite(ledPin, LOW); // sets the LED off
- delay(1000); // waits for a second
+ digitalWrite(BOARD_LED_PIN, HIGH); // sets the LED on
+ delay(1000); // waits for a second
+ digitalWrite(BOARD_LED_PIN, LOW); // sets the LED off
+ delay(1000); // waits for a second
}
Arduino Compatibility
@@ -48,17 +51,16 @@ Arduino Compatibility
.. TODO check out Arduino vs. Maple static discilpline cutoffs to
.. ensure accuracy of following:
-The libmaple implementation of ``pinMode()`` supports the ``INPUT``
-and ``OUTPUT`` modes with semantics identical to that of the Arduino
-function (however, be advised that the Maple, as a 3.3V device, will
-only drive 3.3V to an ``OUTPUT`` pin that has been set ``HIGH``).
+On Maple, pinMode() supports the ``INPUT`` and ``OUTPUT`` modes in the
+same way as Arduino (however, remember that the Maple, as a 3.3V
+device, will only drive 3.3V to an ``OUTPUT`` pin that has been set
+``HIGH``, instead of 5V like on Arduino).
-``INPUT_ANALOG`` and ``PWM`` modes were added because the Maple does
-not distinguish between analog and digital pins the same way the
-Arduino does. Unlike the Arduino, you **must call** ``pinMode()`` to
-set up a pin for these purposes before a call to, e.g.,
-:ref:`lang-analogRead`. In practice, this should only add a few lines
-to your :ref:`lang-setup` function.
+``INPUT_ANALOG`` and ``PWM`` modes were added because the Maple
+doesn't separate the analog and digital pins the same way Arduino
+does. Unlike on Arduino, you **must call** pinMode() to set up a pin
+for these purposes before a call to, e.g., :ref:`lang-analogRead`.
+This should only add a few lines to your :ref:`lang-setup` function.
.. TODO [0.1.0] verify following before putting it in:
@@ -69,9 +71,10 @@ to your :ref:`lang-setup` function.
See Also
--------
-- :ref:`lang-constants`
-- :ref:`lang-digitalwrite`
-- :ref:`lang-digitalread`
-- Maple :ref:`GPIO <gpio>` reference page
+- :ref:`lang-board-values`
+- :ref:`lang-constants`
+- :ref:`lang-digitalwrite`
+- :ref:`lang-digitalread`
+- :ref:`gpio`
.. include:: /arduino-cc-attribution.txt