From aaccec74862d77072498b123f24a02324b86f8bc Mon Sep 17 00:00:00 2001 From: Otavio Carneiro Date: Sat, 31 Oct 2015 17:37:26 -0200 Subject: [PATCH] Improves Fade to ensure PWM pin is used --- build/shared/examples/01.Basics/Fade/Fade.ino | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build/shared/examples/01.Basics/Fade/Fade.ino b/build/shared/examples/01.Basics/Fade/Fade.ino index a8e9eb322..1839ceca2 100644 --- a/build/shared/examples/01.Basics/Fade/Fade.ino +++ b/build/shared/examples/01.Basics/Fade/Fade.ino @@ -4,10 +4,16 @@ This example shows how to fade an LED on pin 9 using the analogWrite() function. + The analogWrite() function uses PWM, so if + you want to change the pin you're using, be + sure to use another PWM capable pin. On most + Arduino, the PWM pins are identified with + a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11. + This example code is in the public domain. */ -int led = 9; // the pin that the LED is attached to +int led = 9; // the PWM pin the LED is attached to int brightness = 0; // how bright the LED is int fadeAmount = 5; // how many points to fade the LED by @@ -32,4 +38,3 @@ void loop() { // wait for 30 milliseconds to see the dimming effect delay(30); } -