Skip to content

Commit aaccec7

Browse files
committed
Improves Fade to ensure PWM pin is used
1 parent e5252e3 commit aaccec7

File tree

1 file changed

+7
-2
lines changed
  • build/shared/examples/01.Basics/Fade

1 file changed

+7
-2
lines changed

build/shared/examples/01.Basics/Fade/Fade.ino

+7-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@
44
This example shows how to fade an LED on pin 9
55
using the analogWrite() function.
66
7+
The analogWrite() function uses PWM, so if
8+
you want to change the pin you're using, be
9+
sure to use another PWM capable pin. On most
10+
Arduino, the PWM pins are identified with
11+
a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11.
12+
713
This example code is in the public domain.
814
*/
915

10-
int led = 9; // the pin that the LED is attached to
16+
int led = 9; // the PWM pin the LED is attached to
1117
int brightness = 0; // how bright the LED is
1218
int fadeAmount = 5; // how many points to fade the LED by
1319

@@ -32,4 +38,3 @@ void loop() {
3238
// wait for 30 milliseconds to see the dimming effect
3339
delay(30);
3440
}
35-

0 commit comments

Comments
 (0)