
Arduino Quick Start
MATRIX is an 8 x 8 RGB LED matrix containing 64 LEDs. Each LED can be controlled independently for on/off state and color, and the overall brightness can also be adjusted.
Connect the control pin to the matrix's SIGNAL input and turn on the independent power switch.
This example uses the FastLED library. Search for and install it through the Arduino Library Manager.
This example lights one LED at a time in the order of the LED chain, advancing every 80 ms while turning off the previous LED to create a repeating white chase effect.
#include <M5Unified.h>
#include <M5GFX.h>
#include <FastLED.h>
/***
* note:You should first install the Fastled library.
***/
#define DATA_PIN 15
#define LED_TYPE WS2811
#define COLOR_ORDER GRB
#define NUM_LEDS 64
CRGB leds[NUM_LEDS];
#define BRIGHTNESS 64
void setup() {
M5.begin();
M5.Lcd.setCursor(120, 110, 4);
M5.Lcd.println("MATRIX");
FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS)
.setCorrection(TypicalLEDStrip);
FastLED.setBrightness(BRIGHTNESS);
}
void loop() {
for (int i = 0; i < NUM_LEDS; i++) {
FastLED.clear();
leds[i] = CRGB::White;
FastLED.show();
delay(80);
}
}After uploading the program, you should see the following result.