Mega 2560/61

Hi All, I am using a mega 2561 which I have up & running, and talking serially without any problems. However I now need to control some pins to turn on LED, select a chip etc. I have tried allocating a pin by: const int ledPin = 2; however this actually allocates the pin as pin 19 as used on the 2560 board. I have also tried using: const int ledPin = PE4; again no success, no matter where I allocate the ledPin, it always ends up on PORT D somewhere. I have a 2560 board, and allocating using the PORT does not work either, although using the board pin numbers does work.

Any help will be appreciated. Thanks Macca

The mapping of the pin numbers used by the arduino library functions is defined in .../hardware/arduino/cores/arduino/pins_arduino.* If you're trying to run on a cpu that isn't directly supported by the Arduino IDE (or isn't pin-compatible with a directly supported CPU), you'll have to edit this file appropriately.

Thanks, that was the link I needed.