Skip to content

Instantly share code, notes, and snippets.

@d1runberg
Created August 4, 2015 17:35
//create a global variable for brightness and
//set it to 2
int brightness = 2;
void setup()
{
//set pin 9 to output, any PWM(~) pin will work
//with analogWrite()
pinMode(9,OUTPUT);
}
void loop()
{
//analogWrite the value of brightness to pin 9
//change the variable of brightness to any number between
//0 and 255 which is the full range of analogWrite()
//you will only see a brightness change in values 0-100!
analogWrite(9,brightness);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment