Controlling Atom Matrix LEDs



  • I'm trying to learn how to manipulate the LED matrix on the M5Stack Atom Matrix device and I'm struggling to find complete examples or get FastLED to work with it. In my experience with FastLED, I should be able to initialize the matrix with the following code:

    #include "M5Atom.h"
    #include <FastLED.h>
    
    #define NUM_LEDS 25
    #define DATA_PIN 27
    
    CRGB leds[NUM_LEDS];
    
    void setup() {
    
      Serial.begin(115200);
      delay(1000);
    
      Serial.println("");
      Serial.println("Initializing M5Stack Atom Matrix");
      M5.begin(true, false, true);
    
      // Initialize the FastLED library for this device's configuration
      Serial.println("\nInitializing FastLED");
      FastLED.addLeds<WS2812, DATA_PIN>(leds, NUM_LEDS);
    
      // M5Stack recommends not setting this value greater than 20
      // to avoid melting the screen/cover over the LEDs
      Serial.println("Setting brightness");
      FastLED.setBrightness(20);
    
      // Initialize all device LEDs to off (black)
      Serial.println("Clearing display");
      for (int num = 0; num < NUM_LEDS; num++) {
        Serial.println(num);
        leds[num] = CRGB::Black;
      }
      Serial.println("Showing LEDs");
      FastLED.show();
      
      Serial.println("Finishing setup");
      
    }
    

    I have a bunch of extra code in there so I can tell where setup fails, and it's at the point where I call FastLED.show() - everything to that point is textbook FastLED, but this just doesn't work.

    It's possible, or even likely, that this is an issue with FastLED, but I simply can't find a simple, functioning example of how to code the matrix. There's a sample app buried in the SDK here: https://github.com/m5stack/M5Atom/blob/master/examples/Basics/LEDDisplay/LEDDisplay.ino, but I can't find documentation of the dis object used in that example (looking at the code, and understanding that the DisPlay library isn't even loaded by M5 I doubt it will even compile.



  • Here you go. This works...

    //#include "M5Atom.h"  //not needed
    #include <FastLED.h>
    
    #define NUM_LEDS 25
    #define DATA_PIN 27
    
    CRGB leds[NUM_LEDS];
    
    void setup() {
      Serial.begin(115200);
      delay(1000);
    
      Serial.println("");
      Serial.println("Initializing M5Stack Atom Matrix");
      //M5.begin(true, false, true);  //not needed
    
      // Initialize the FastLED library for this device's configuration
      Serial.println("\nInitializing FastLED");
      //FastLED.addLeds<WS2812, DATA_PIN>(leds, NUM_LEDS);
      FastLED.addLeds<WS2812, DATA_PIN, GRB>(leds, NUM_LEDS);
    
      // M5Stack recommends not setting this value greater than 20
      // to avoid melting the screen/cover over the LEDs
      Serial.println("Setting brightness");
      FastLED.setBrightness(20);
      Serial.println("Finishing setup");
    }
    
    void loop() {
      // Initialize all device LEDs to off (black), one at a time
      Serial.println("Clearing display");
      for(int num=0; num<NUM_LEDS; num++) {
        Serial.println(num);
        leds[num] = CRGB::Black;
        FastLED.show();
        delay(50);
      }
      delay(500);
      // Initialize device LEDs to on (red), one at a time
      Serial.println("Showing LEDs");
      for(int num=0; num<NUM_LEDS; num++) {
        Serial.println(num);
        leds[num] = CRGB::Red;
        FastLED.show(); 
        delay(50);
      }
    }
    


  • @world101 interesting, thanks - I'll give it a try.

    yep, that worked - thanks!!



  • Hello...The fundamental control receives the ESP32-PICO chip which comes incorporated with Wi-Fi and Bluetooth advances and has a 4MB of coordinated SPI streak memory. Particle board gives an Infra-Red LED, RGB LED, catches, and a PH2.0 interface. Furthermore, it can associate with outer sensors and actuators through 6 GPIOs. The on-board Type-C USB interface empowers quick program transfer and execution.

    pcb quote