Arduino Progress

I found a prewritten sketch with a handy RGB color transition maker. It barely needed any changes to work… just switched some pins, and it basically worked out of the box!:

https://www.arduino.cc/en/Tutorial/ColorCrossfader

______________________________

I used some code from a more advanced exercise we may do in the future (the three button RGB changer). It did take a little hacking, since I had to simplify the code dramatically. I also had to learn the hard way that only pins 3, 5, 6, 9, 10, and 11 can do non binary brightness:

 

int ledPin = 11; // choose the pin for the LED
int turnItUp = 3; // button 1
int turnItDown = 2; // button 2
int brightness = 0;

void setup()
{
pinMode(ledPin, INPUT_PULLUP); // declare LED as output
pinMode(turnItUp, INPUT); // make button 1 an input
pinMode(turnItDown, INPUT); // make button 2 an input
}

void loop(){
if (digitalRead(turnItUp) == LOW) {
brightness ++; // turn LED OFF
}
if (digitalRead(turnItDown) == LOW) {
brightness –; // turn LED OFF
}
analogWrite(ledPin, brightness);
delay(10);
}