Hi, I'm using two different libraries in my arduino code and my problem is that one of them lets me assign the pins in the same code that I do, but the other library assumes the digital pins privately and I dont know how to change the assignment of the pins. The library in question is for the led rgb matrix panel 16x32.
So, I want change the assignment of pin 2 to another different digital pin (for example, digital pin 11) since this pin 2 is needed for another use. (for an interruption).
There are pin assignments that the library chooses privately. That pin assignment that you have showed me doesn't show what I need. Pin OE, CLK, A, B, C.... are public but there are another pins (r, g, b) that library choose privately and I dont know how to change them.
If you're going to do that then please be considerate enough to add links to the other places you cross posted. This will let us avoid wasting time due to duplicate effort and also help others who have the same questions and find your post to discover all the relevant information. When you post links please always use the chain links icon on the toolbar to make them clickable.
I think your advice is perfect but it doesn't solve my problem.
Please, I think one alternative, in the library there is an assignment: DDRD = B11111100,
If I change to DDRD = B11111000,
I understand why all the pins need to be on the same port, since if they're on different ports each write will take twice as long. What I don't understand is why @PaintYourDragon says only PORTD can be used. It seems like any port could be used as long as the pins are all on that port
I got it. I have neutralized the red color(Pin Digital 2) at the top of the screen (I didn't need it) and I already have the digital pin 2 FREE for interruptions.
wavewolf:
I got it. I have neutralized the red color(Pin Digital 2) at the top of the screen (I didn't need it) and I already have the digital pin 2 FREE for interruptions.
I have modified several things in the library.
Why don't you provide some details of what you did to help others who might want to do the same thing?
OBJECTIVE: Leave digital pin 2 arduino free to use it in an interruption.
PROBLEM: Matrix of led RGB 16x32 Adafruit uses digital pin 2 for the color Red at the top of the screen (R1).
SOLUTION:
In the library provided by Adafruit, you have to change several things:
-1 In "RGBmatrixPanel.cpp" row 175 you have to change "DATADIR = B11111100;" for
DATADIR = B11111000;
With this, what is achieved is to avoid defining digital pin 2 as an output and leaving it as input.
-2 In "RGBmatrixPanel.cpp" row 195 you have to modify it like this:
With this, what is achieved is to neutralize the color Red in the function "Color333 ()" and thus there will be no problems.
-3 In "RGBmatrixPanel.h" you have to modify the following in row 31 "Color333 (uint8_t r, uint8_t g, uint8_t b)" by:
Color333 (uint8_t g, uint8_t b)
4- Once all this is done, you have to save everything and do the following:
The pin of the RGB screen (R1) that went to the digital pin 2 of the arduino must be set to GND.
5- Once all this is done, when you make code, simply use the function "Color333 ()" for the top of the RGB screen and all other functions for the bottom of the screen.