int TIP120pin = 11; //Arduino's PMW pin 11 int speedValue; void setup() { // nothing happens in setup } void loop() { // ramp in from min to max in increments of 5 points: for(int speedValue = 0 ; speedValue <= 255; speedValue +=5) { // sets the value (range from 0 to 255): analogWrite(TIP120pin, speedValue); // wait for 30 milliseconds to see the effect delay(30); } // ramp out from max to min in increments of 5 points: for(int speedValue = 255 ; speedValue >= 0; speedValue -=5) { // sets the value (range from 0 to 255): analogWrite(TIP120pin, speedValue); // wait for 30 milliseconds to see the effect delay(30); } }