/*

  Mega analogWrite() test

  This sketch fades LEDs up and down one at a time on digital pins 2 through 13.

  This sketch was written for the Arduino Mega, and will not work on other boards.

  The circuit:

  - LEDs attached from pins 2 through 13 to ground.

  created 8 Feb 2009

  by Tom Igoe

  This example code is in the public domain.

  http://www.arduino.cc/en/Tutorial/AnalogWriteMega

*/

// These constants won't change. They're used to give names to the pins used:

const int lowestPin = 2;

const int highestPin = 13;

void setup() {

  // set pins 2 through 13 as outputs:

  for (int thisPin = lowestPin; thisPin <= highestPin; thisPin++) {

    pinMode(thisPin, OUTPUT);

  }
}

void loop() {

  // iterate over the pins:

  for (int thisPin = lowestPin; thisPin <= highestPin; thisPin++) {

    // fade the LED on thisPin from off to brightest:

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

      analogWrite(thisPin, brightness);

      delay(2);

    }

    // fade the LED on thisPin from brightest to off:

    for (int brightness = 255; brightness >= 0; brightness--) {

      analogWrite(thisPin, brightness);

      delay(2);

    }

    // pause between LEDs:

    delay(100);

  }
}
mega:SCL
mega:SDA
mega:AREF
mega:GND.1
mega:13
mega:12
mega:11
mega:10
mega:9
mega:8
mega:7
mega:6
mega:5
mega:4
mega:3
mega:2
mega:1
mega:0
mega:14
mega:15
mega:16
mega:17
mega:18
mega:19
mega:20
mega:21
mega:5V.1
mega:5V.2
mega:22
mega:23
mega:24
mega:25
mega:26
mega:27
mega:28
mega:29
mega:30
mega:31
mega:32
mega:33
mega:34
mega:35
mega:36
mega:37
mega:38
mega:39
mega:40
mega:41
mega:42
mega:43
mega:44
mega:45
mega:46
mega:47
mega:48
mega:49
mega:50
mega:51
mega:52
mega:53
mega:GND.4
mega:GND.5
mega:IOREF
mega:RESET
mega:3.3V
mega:5V
mega:GND.2
mega:GND.3
mega:VIN
mega:A0
mega:A1
mega:A2
mega:A3
mega:A4
mega:A5
mega:A6
mega:A7
mega:A8
mega:A9
mega:A10
mega:A11
mega:A12
mega:A13
mega:A14
mega:A15
led1:A
led1:C
led2:A
led2:C
led3:A
led3:C
led4:A
led4:C
led5:A
led5:C
led6:A
led6:C
led7:A
led7:C
led8:A
led8:C
led9:A
led9:C
led10:A
led10:C
led11:A
led11:C
led12:A
led12:C
Arduino Code Sharing - Embedded Project