RGB LED pin modification for Pro Micro [SOLVED]

Hi,

I am trying to modify arduboy2 library for makeing arduboy clone with Pro Micro.
Now I have my speaker and SH1106 display working and I would like to add RGB LED.
Since Pro Micro does not have the PIN 11, I need to modify the library.

Here is what I did.

In Arduboy2Core.h

#define GREEN_LED 11 /**< The pin number for the greem color in the RGB LED. */

to

#define GREEN_LED 3 /**< The pin number for the greem color in the RGB LED. */

Then I uploaded RGBled sketch to the boad but the green LED did not react.
I swapped the wiring and I confirmed the LED is ok.

Is there anything what I need to do more to modify the LED pin assign of Arduboy2 library?

According to Google, Pin 3 is can be mapped to an interrupt - I am only guessing but I wonder if this is causing you problems? Can you map it to another, unused pin?

https://learn.sparkfun.com/tutorials/pro-micro--fio-v3-hookup-guide/hardware-overview-pro-micro

1 Like

You could always just use @Mr.Blinky’s “homemade package”, where all of the hard work has already been done for you? And then just use the “ProMicro 5V (alternate wiring)” pin assignments:

4 Likes

You also need to change GREEN_LED_PORT and GREEN_LED_BIT

Like @uXe said you can also use my Homemade package and choose Homemade Arduboy + ProMicro with alternate wiring + SH1106 display from the Tools menu to make things easier.

2 Likes

Alternatively depending on the 32u4 package you have you can just solder to the unconnected pins.

@filmote
Thank you for the link. PIN 3 should work as LED green but I will check the info to learn some more about the board.

@uXe
Oh, I did miss this information…
Thank you!

@MrBlinky
Wow, the great job has been done already! Thank you so much for sharing it! I will look into the library to study!

@Keyboard_Camper]
Got it! Thanks for the advice!

To complete @Keyboard_Camper There are Pro Micro’s versions which use a larger version of the ATMEGA32U4 with larger pins. If you have a soldering iron with a small tip you can solder directly to the pins to break out the missing signals.

1 Like

@Blinky Looking at my board and I found mine has the smaller version of 32U4 unfortunately.

Now my Arduboy2Core.h has been modified as below but still my LED Green does not respond.

#define GREEN_LED 3 /**< The pin number for the green color in the RGB LED. */
#define GREEN_LED_PORT PORTD
#define GREEN_LED_BIT PORTD0

The led turns to red, off, blue and off. No green.
Don’t I need to push any button to lit it in green for RGBled.ino in Arduboy2 examples, do I…? Have never built buttons yet.

Because the port changed, you also need to change the port initialisation in Arduboy2Core.cpp

In the Homemade package (Don’t you just love advertising? :stuck_out_tongue: ) there’s a hardware test example you can use to test the hardware wiring including the RGB LED

1 Like

And in the latest Arduboy2 library, there’s the RGBled example sketch, which can set the RGB LED to all possible values in both digital and analog modes.

@Mr.Blinky

“(Don’t you just love advertising? )”
Yes I do. Indeed I have just installed the Homemade package after hustling several hours to modify Arduboy2Core.cpp by myself. I just wanted to be a bit more like a developer not just being a pure consumer.

After modifying Core.h of Arduboy Library (this was easy), it seems that I have Arduboy and Arduboy2 working perfectly on my pretty Pro Micro!

@MLXXXp
Yes, I will run the sketch after adding buttons to my tiny one. I can’t wait!

Well anyway, thank you so much for the support guys. I really appreciate it!

4 Likes