I made a board for my project based on Arduino Pro Mini. The problem is, that I had to put the LED on pin 4 instead of pin 13.

What setting do I have to change to make pin 4 the default one? Or do I have to write my own Board Library?

up vote 3 down vote accepted

The blinking while uploading makes the bootloader. Arduino Mini uses Optiboot. The source codes are on GitHub. You would need to change the pin in pin_defs.h and make the bootloader. Then flash it to the 328p with a programmer over ICSP.

Details what to change are in Greenonline's answer.

Following on from Juraj's answer:

The blinking while uploading makes the bootloader. Arduino Mini uses Optiboot. The source codes are on GitHub. You would need to change the pin in pin_defs.h and make the bootloader. Then flash it to the 328p with a programmer over ICSP.

The line that you need to change in pin_defs.h is line number 27:

#define LED B5

As you can see it is currently set to B5. This is the fifth bit in port B which corresponds to pin 13

Pin 4 corresponds to PORTD bit 4, so the line would become

#define LED D4

The Arduino digital pins are connected to three different banks of 8 bits, known as ports (PORTD, PORTB and PORTC`). To see their relation, refer to this table from Arduino Playground - Pins

Ports to Pins table

  • I copied my answer as intro into this answer – Juraj Aug 14 at 12:15
  • Ok, thanks. I'm not sure it was necessary, unless you planned on deleting your answer. However, I've added a link back to yours to reference the quote, and it makes a bit more sense that way. Thanks again :-). – Greenonline Aug 14 at 13:56

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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