Exercise 3: Fading an LED

Ryan Ferguson

Arduino Servo Lab

Instructions

1. Follow the diagram above to create your servo circuit.

2. Copy and paste the text below into your Arduino sketch. Run the sketch. 

///////////////////////

// the setup routine runs once when you press reset:

void setup() {

}


// the loop routine runs over and over again forever:

void loop() {


  for(int i=0; i<255; i++){

    analogWrite(11, i);

    delay(10);

  }

  for(int i=0; i>0; i--){

    analogWrite(11, i);

    delay(10);

  }

}