Wiki

/***************************************************
*
* For 32x32 RGB LED matrix.
*
* @author lg.gang
* @version V1.0
* @date 2016-10-28
*
* GNU Lesser General Public License.
* See <http://www.gnu.org/licenses/> for details.
* All above must be included in any redistribution
* ****************************************************/
#include <Adafruit_GFX.h> // Core graphics library
#include <RGBmatrixPanel.h> // Hardware-specific library
// If your 32x32 matrix has the SINGLE HEADER input,
// use this pinout:
#define CLK 8 // MUST be on PORTB! (Use pin 11 on Mega)
#define OE 9
#define LAT 10
#define A A0
#define B A1
#define C A2
#define D A3
// If your matrix has the DOUBLE HEADER input, use:
//#define CLK 8 // MUST be on PORTB! (Use pin 11 on Mega)
//#define LAT 9
//#define OE 10
//#define A A3
//#define B A2
//#define C A1
//#define D A0
RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false);
void setup() {
matrix.begin();
// whew!
}
void loop() {
// fix the screen with red
matrix.fillRect(0, 0, 32, 32, matrix.Color333(7, 0, 0));
delay(500);
// fix the screen with green
matrix.fillRect(0, 0, 32, 32, matrix.Color333(0, 7, 0));
delay(500);
// fix the screen with blue
matrix.fillRect(0, 0, 32, 32, matrix.Color333(0, 0, 7));
delay(500);
// fix the screen with yellow
matrix.fillRect(0, 0, 32, 32, matrix.Color333(7, 7, 0));
delay(500);
// fix the screen with purple
matrix.fillRect(0, 0, 32, 32, matrix.Color333(7, 0, 7));
delay(500);
// fix the screen with cyan
matrix.fillRect(0, 0, 32, 32, matrix.Color333(0,7, 7));
delay(500);
// fix the screen with white
matrix.fillRect(0, 0, 32, 32, matrix.Color333(3, 3, 3));
delay(500);
// fill the screen with 'black'
matrix.fillScreen(matrix.Color333(0, 0, 0));
// draw a pixel in solid white
matrix.drawPixel(0, 0, matrix.Color333(7, 7, 7));
delay(500);
// fix the screen with green
matrix.fillRect(0, 0, 32, 32, matrix.Color333(0, 7, 0));
delay(500);
// draw a box in yellow
matrix.drawRect(0, 0, 32, 32, matrix.Color333(7, 7, 0));
delay(500);
// draw an 'X' in red