Running arduino pins

I am running @Mr.Blinky package on a pro micro. This means that the Arduino libraries are no longer in the arduino folder, so I can’t edit them, as I don’t know where they are. Even if I did, I believe the Arduboy framerate would mess with any pin meddling I would want to do…

Is there a way to take control of the arduino pins in a normal way, maybe by including <Arduino.h> or something so that I can run things on the unused pins?

If used as recommended, @Mr.Blinky’s libraries just replace the official libraries file for file, thus will be located in the same spot under Arduino/libraries

You shouldn’t have to do anything special to use any pin in the normal Arduino way, as long as it doesn’t conflict with the library code using it. No extra includes should be required.


pinMode(A5, OUTPUT);
digitalWrite(A5, HIGH);

Note, though, that using the Arduino pin control functions will probably pull in extra code, since the Arduboy2 library (and likely derivatives and other Arduboy libraries) doesn’t use these functions, so doesn’t pull them in. To avoid this, to gain more code space, you would have to control the pins directly through the hardware registers, like most Arduboy libraries do.


Not sure what you mean by that. No libraries are removed. If you want to know where the homemade package and its libraries are, open Arduino preferences and click on the preferences.txt at the bottlom left corner.


In the folder that opens, browse into:


There you’ll find all the libraries included by the homemade package.

The homemade package uses an Arduboy optimized core by default. Try choosing the ‘Standard Arduino core’ as core from the tools menu and see if that helps.

1 Like

That was what I was looking for, thank you! Basically the library doesn’t show up in the stock Arduino libraries folder, so I couldn’t find it.

Another question:
When I run the example LED and sound programs, everything is reversed. 255 represents off, the sounds run on disabled instead of audio enabled. etc. Is this a known thing or did I do something backwards?

Good to know, thank you!

The Arduboy’s RGB LED is common anode, which is wired to Vcc. Therefore, you have to pull the cathodes low to light its LEDs. This means in digital mode LOW will light the LED and HIGH will turn it off. In analogue mode a 255 will be off and 0 will be fully on.

The Arduboy2 library functions and defines compensate for this inversion if used as documented.

As for the audio enable/disable being reversed, that makes no sense to me.

@Mr.Blinky I’m looking through the library and pin assignments to try to just re-map the speaker pin 2 to Arduino Micro pin 3(pwm) for “pro Micro 5v - Standard wiring” but I can’t find where the actual pin is assigned for audio ( either TONE_PIN_PORT, TONE_PIN, or SPEAKER_2_DDR, SPEAKER_2_BIT

Do you know where I could find these, or is this process going to be way over my head?

Thank you

If you look inside


Here you should see this file among others:


Open “Arduboy2Core.h” in your favorite text editor and look at lines 187-203 for the speaker pin port defines, and edit them to your liking. Make sure you are using the correct port labels in your define or it will not work. Save the file, exit.

These defines are referenced by “Arduboy2Audio.cpp” to initialize the pins. If you want to know how that works as well, it’s a pretty small file and fairly self-explanatory, so it’s a short read.

Awesome, thanks! I totally overlooked that.

#define PIN_SPEAKER_2 13 /**< The pin number of the second lead of the speaker */


#define PIN_SPEAKER_2 3 /**< The pin number of the second lead of the speaker */

Would you happen to know if that’s right?

@thatringokid, just to let you know, I’ve edited the code you posted into code blocks.

You may want to have a quick read of this thread:

It explains how to use code blocks, among other things.

@Pharap sorry! Thanks

1 Like

Looks good! I don’t know if you plan to make changes to any other pins but if so I’d keep the Arduino PortManipulation page tabbed, even if you’re familiar it’s good for reference to be certain. A pinout sheet of the pro micro or just the atmega32u4 that includes ports in its key is also handy, i.e., this one:

1 Like

Nice! Wasn’t sure what the DDR bit did exactly.
Good tip on the chart, i don’t ever deal with the ports directly so I’ll def take that

DDR is explained more in-depth in that Port Manipulation page I linked, but basically it tells the microcontroller what the assigned port is being used as. So there’s DDRA, DDRB, DDRC, and DDRD, each corresponding to either a read or write mode (input vs. output) and a range of either the digital or analog pins. So in your case, it was DDRC first because it was being used as an output on pin 13, but now that it’s set to pin 3, it needs to be DDRD, as D is the indicator for digital pins 0-7 (typically. again, a pinout or datasheet of the atmega32u4 is your best friend here.)


Makes sense. Thanks so much

1 Like

:confused: I don’t think the timer is the same on that pin or something. Beep2 doesn’t seem to work.

Assigned the to BeepPin2, began it, started the timer. Ran it the same way I would run pin1.
Pin1 works, Pin 2 does not

rumble.tone(rumble.freq(659.255), 50);

The BeepPin classes in the Arduboy2 library each use a timer/counter to generate the frequencies. Each timer/counter can only control certain pins.

Speaker Pin 1 is on Arduino Pin 5, which is Port C6. The BeepPin1 class uses timer/counter 3A to generate the tones on this pin.

Speaker Pin 2 is on Arduino Pin 13, which is Port C7. The BeepPin2 class uses timer/counter 4A to generate the tones on this pin.

If you wanted to reassign Speaker Pin 2 to Arduino Pin 3 (Port D0), you would have to use timer/counter 0B because it’s the only one capable of controlling this pin. However, timer/counter 0 is used as the main system timer, so you may run into difficulties trying to use it as a BeepPin frequency generator.

The Arduboy speaker pins were specifically chosen with consideration to which timer/counters were able to control them.

@MLXXXp yea i was looking around in the library and found the timer, just wasn’t sure which other options i had and if they would be the same interval as beepin1 or what 2 was supposed to be. Ill have to look into it tomorrow, i figured there was a reason it wasn’t just put on pin 3. I may just make my life easier and switch to a full sized Leonardo. Thanks for the info

I used an Arduino Micro for my breadboard system, the drawback being that the TX and RX LEDs are reverse polarity to an Arduboy or Leonardo. This isn’t a problem if you compile the sketches for an Arduino Micro.

This guide by @Mr.Blinky is useful for selecting a board:


I hadn’t see that image before but its really clear and should help a lot of newbies.

1 Like