aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/lang/api/digitalwrite.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/digitalwrite.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/digitalwrite.rst')
-rw-r--r--docs/source/lang/api/digitalwrite.rst39
1 files changed, 13 insertions, 26 deletions
diff --git a/docs/source/lang/api/digitalwrite.rst b/docs/source/lang/api/digitalwrite.rst
index 6124d5f..376cbc3 100644
--- a/docs/source/lang/api/digitalwrite.rst
+++ b/docs/source/lang/api/digitalwrite.rst
@@ -21,42 +21,26 @@ If the pin has been configured as an ``OUTPUT`` with :ref:`pinMode()
<lang-pinmode>` its voltage will be set to the corresponding value:
3.3V for ``HIGH``, and 0V (ground) for ``LOW``.
-.. TODO make the following paragraphs true, but refer the reader to
-.. INPUT_PULLUP and INPUT_PULLDOWN:
-
-If the pin is configured as an ``INPUT``, writing a ``HIGH`` value
-with ``digitalWrite()`` will enable an internal pullup resistor.
-Writing ``LOW`` will disable the pullup. The pullup resistor is enough
-to light an LED dimly, so if LEDs appear to work, but very dimly, this
-is a likely cause. The remedy is to set the pin to an output with the
-:ref:`pinMode() <lang-pinmode>` function.
-
-.. note:: Pin 13 is harder to use as an input than the other pins
- because it has an LED and resistor soldered to it in series. If you
- enable its internal pull-up resistor, it will likely hang at around
- 1.1V instead of the expected 3.3V because the onboard LED and
- series resistor pull the voltage level down. If you must use pin 13
- as a digital input, use an external pull-down resistor.
+Because it is soldered to an LED and resistor in series, your board's
+:ref:`BOARD_LED_PIN <lang-board-values-led>` will respond slightly
+more slowly as an output than the other pins.
Example
-------
The following example sets pin 13 to ``HIGH``, makes a one-second-long
delay, sets the pin back to ``LOW``, and delays again, causing a
-blinking pattern::
-
-
- int ledPin = 13; // LED connected to digital pin 13
+blinking pattern (you could also use :ref:`lang-toggleled`)::
void setup() {
- pinMode(ledPin, OUTPUT); // sets the digital pin as output
+ pinMode(BOARD_LED_PIN, OUTPUT); // sets the digital 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
}
See Also
@@ -64,5 +48,8 @@ See Also
- :ref:`pinMode <lang-pinmode>`
- :ref:`digitalRead <lang-digitalread>`
+- :ref:`BOARD_LED_PIN <lang-board-values-led>`
+- :ref:`lang-toggleled`
+- :ref:`lang-togglepin`
-.. include:: cc-attribution.txt
+.. include:: /arduino-cc-attribution.txt