so i replaced the mainboard in (what was) an anet a8 3d printer with a proper RAMPS setup. there was nothing wrong with it, (or at least it wasnt damaged, there are a number of severe design flaws) so i thought it might be a good start point for a remote controlled crawler/bot thing. it already has four a4988 drivers on board, plus a few mosfets and other bits which will be great for accessories (planning headlights, horn, maybe light sensor). its built around the atmega1284p, which is something of an oddball inbetween the 328 on the uno and the 2560 on the mega, but is the same product line. ive already worked out the libraries/drivers for the ch340 or whatever it is that is needed to flash code to the board,it already has already been added to the arduino ide, i have successfully flashed sketches to it before, but not my own. what im wondering is how to declare pins when im writing my own code. the bottom right of this schematic lists connections to the main chip, is it reasonably safe to assume that the digital pin numbers listed there can be used like the normally labeled headers on a standard board? how exactly are those numbers determined?

  • 2
    Does this answer your question? Adding a custom board to the Arduino IDE
    – Juraj
    Aug 30, 2020 at 3:48
  • 1
    example github.com/jandrassy/my_boards
    – Juraj
    Aug 30, 2020 at 3:49
  • Each chip uses the normal register names (like PORTB or DDRA) with the bits representing a pin. The pin numbers, that you know from other Arduinos are just referencing to them. The numbers are defined in the core for the used chip. So when you are installing the core for the used chip inside the Arduino IDE, that core also defines the pin numbers.
    – chrisl
    Aug 30, 2020 at 10:43
  • 1
    @Juraj a custom board file has already been made by someone, it sounds like i need to dig through those core files to find where things get enumerated or whatever the word is Aug 30, 2020 at 17:34
  • not much digging. it is the variants folder. in my_boards I have a custom 1284p too
    – Juraj
    Aug 30, 2020 at 17:58

1 Answer 1


ok so what ive found is that pins are declared in a file, pins_arduino.h. for each board/chip/variant another file is added(or created, if writing your own) to the arduino hardware files. in my specific case the numbers in the graphic are consistent with those listed in the hardware file, so im good

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.