diff options
author | Marti Bolivar <mbolivar@mit.edu> | 2010-12-03 20:18:00 -0500 |
---|---|---|
committer | Marti Bolivar <mbolivar@mit.edu> | 2010-12-03 20:18:00 -0500 |
commit | 210f3d2b1555bae87c9de27ea145e16d3bddb0f8 (patch) | |
tree | 5e409fff948c9a1847d08e5ec34f905ea2212956 /source/lang/pwmwrite.rst | |
parent | 11573d0fca18ef2ccd965ab67d419afd48b7cef2 (diff) | |
download | librambutan-210f3d2b1555bae87c9de27ea145e16d3bddb0f8.tar.gz librambutan-210f3d2b1555bae87c9de27ea145e16d3bddb0f8.zip |
cleaning up previous commits.
note that addition of new files under docs/source/lang/api and
docs/source/lang/cpp which were just copies of files in
docs/source/lang/ imply that change history is lost to git.
Diffstat (limited to 'source/lang/pwmwrite.rst')
-rw-r--r-- | source/lang/pwmwrite.rst | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/source/lang/pwmwrite.rst b/source/lang/pwmwrite.rst deleted file mode 100644 index 7a1d51f..0000000 --- a/source/lang/pwmwrite.rst +++ /dev/null @@ -1,49 +0,0 @@ -.. highlight:: cpp - -.. _lang-pwmwrite: - -pwmWrite() -========== - -Writes a :ref:`PWM wave <pwm>` to a pin. You can use this to make an -LED get brighter or dimmer, control a servomotor, etc. After a call to -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. - -.. contents:: Contents - :local: - -Library Documentation ---------------------- - -.. doxygenfunction:: pwmWrite - -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(analogPin, PWM); // sets the potentiometer pin as PWM - // output - } - - 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 - } - -See Also --------- - -- :ref:`Maple PWM tutorial <pwm>` |