Skip to content

Improves Fade to ensure PWM pin is used #4061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 4, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions build/shared/examples/01.Basics/Fade/Fade.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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

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