From 19e8336afbc827378216aca2b1af45ef89a108ab Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Sun, 21 Nov 2010 01:40:37 -0500 Subject: updated serial bootloader spec; other improvements --- docs/source/wirish/pwmwrite.rst | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'docs/source/wirish') diff --git a/docs/source/wirish/pwmwrite.rst b/docs/source/wirish/pwmwrite.rst index b1f0515..7667a72 100644 --- a/docs/source/wirish/pwmwrite.rst +++ b/docs/source/wirish/pwmwrite.rst @@ -24,26 +24,25 @@ Example Sets the output to the LED proportional to the value read from the potentiometer (adapted for Maple from the Arduino `analogWrite() -reference `_\ ):: +reference `_):: - - int ledPin = 13; // LED connected to pin 13 (Maple-specific) + + 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 (Maple-specific) + // 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 - // (Maple-specific) } See Also -- cgit v1.2.3