aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/lang/api/pwmwrite.rst
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@mit.edu>2010-12-15 01:50:56 -0500
committerMarti Bolivar <mbolivar@mit.edu>2010-12-15 16:16:31 -0500
commitd744fb826f4a6d6ce560f3b78f2e63a1f9666d9e (patch)
tree35d0939c959cec372e1a6ce2f4bdf95dbe977918 /docs/source/lang/api/pwmwrite.rst
parent74c8937446e1be4e0d21f69a8c098e2caf7814d5 (diff)
downloadlibrambutan-d744fb826f4a6d6ce560f3b78f2e63a1f9666d9e.tar.gz
librambutan-d744fb826f4a6d6ce560f3b78f2e63a1f9666d9e.zip
Finalized 0.0.9 documentation.
Diffstat (limited to 'docs/source/lang/api/pwmwrite.rst')
-rw-r--r--docs/source/lang/api/pwmwrite.rst15
1 files changed, 11 insertions, 4 deletions
diff --git a/docs/source/lang/api/pwmwrite.rst b/docs/source/lang/api/pwmwrite.rst
index 7a1d51f..2c858ab 100644
--- a/docs/source/lang/api/pwmwrite.rst
+++ b/docs/source/lang/api/pwmwrite.rst
@@ -11,6 +11,13 @@ pwmWrite(), the pin will output a steady square wave with the given
duty cycle. You can change the duty cycle later by calling pwmWrite()
again with the same pin and a different duty.
+On the Maple, the pins which support PWM are: 0, 1, 2, 3, 5, 6, 7, 8,
+9, 11, 12, 14, 24, 27, and 28.
+
+The Arduino function :ref:`analogWrite() <lang-analogwrite>` is an
+alias for ``pwmWrite()``, but it is badly named, and its use is
+discouraged.
+
.. contents:: Contents
:local:
@@ -25,12 +32,11 @@ Example
Sets the output to the LED proportional to the value read from the
potentiometer::
- int ledPin = 13; // LED connected to pin 13 (Maple)
int analogPin = 3; // potentiometer connected to analog pin 3
int val = 0; // variable to store the read value
void setup() {
- pinMode(ledPin, OUTPUT); // sets the LED pin as output
+ pinMode(BOARD_LED_PIN, OUTPUT); // sets the LED pin as output
pinMode(analogPin, PWM); // sets the potentiometer pin as PWM
// output
@@ -39,8 +45,9 @@ potentiometer::
void loop() {
val = analogRead(analogPin); // read the input pin
- analogWrite(ledPin, val / 16); // analogRead values go from 0 to 4095,
- // analogWrite values from 0 to 65535
+ analogWrite(BOARD_LED_PIN, val / 16); // analogRead values go from 0
+ // to 4095, analogWrite values
+ // from 0 to 65535
}
See Also