Programming the WeMos Matrix LED Shield

The WeMos Matrix LED Shield is a grid of 8x8 LEDs that can all singularly be controlled. This opens up a world of creative promise especially when paired with the capabilities of the D1 mini's wifi. 

   

But before we get ahead of ourselves lets start with the bare minimum of what you will need to begin creating with Matrix LED Shield.

LED Matrix Shield for WeMos D1 Mini WeMos D1 Mini

Shopping List

 

The libraries necessary to run the shield can be found on Github at: https://github.com/wemos/WEMOS_Matrix_LED_Shield_Arduino_Library. You can download and extract the zip files for the library and place them in your ~/Documents/Arduino/Libraries/ folder. 

After restarting the Arduino IDE, you should see the folder name you added to the libraries folder under "Sketch" then "Include Library".

With this in place you can begin writing code for the shield. I have included the example one that comes with the library files below. This code when uploaded to the WeMos D1 mini will light up each LED by row then column for a moment and then move to the next progressively as shown below.

#include <WEMOS_Matrix_LED.h>
MLED mled(5);//set intensity=5

void setup() {   
  // put your setup code here, to run once: 
}

void loop() {   
  for(int y=0;y<8;y++){  
    for(int x=0;x<8;x++){      
      mled.dot(x,y); // draw dot      
      mled.display();
      delay(200);      
      mled.dot(x,y,0);//clear dot     
      mled.display();
      delay(200);
     }
   } 
}

 

I have also made an example sketch you can use to show a bit more of the what this shield can do.


/* Gadgets that Go
 * Matrix LED Rain (WeMos Matrix Shield Example)
 * Created 2017-9-2 / Aaron Schnetzer
 */

#include <WEMOS_Matrix_LED.h>
long interval = 650; //update interval
long previous = 0;
int randx;
MLED led(2); //update from 0-8

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115000);
}

void loop(){
  // put your main code here, to run repeatedly:
  long current = millis();
  if(current - previous > interval){
      previous = current;
      randx = random(8); 
      
      //create rain drop effect
        for(int i=7; i>-1; i--){        
            led.dot(randx,i);
            led.display();
            delay(interval/7);
            led.dot(randx,i,0);//clear dot
        }
    }
}

 

If you're ready to get started you can shop Gadgets That Go for the D1 Mini and LED Shield.


Leave a comment

Please note, comments must be approved before they are published