Hackster is hosting Hackster Holidays, Finale: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Tuesday!Stream Hackster Holidays, Finale on Tuesday!
Corey Jones
Published © MIT

Christmas Lights! Neopixel Led Matrix Glass Block Wall

A glass block wall, each block fitted with a single neopixel and the whole screen driven by a Spark Core to create awesome Christmas images!

Full instructions provided10,024
Christmas Lights! Neopixel Led Matrix Glass Block Wall

Things used in this project

Hardware components

Spark Core
Particle Spark Core
×1
60 Led per Meter Neopixels
×4
Hook-up wire spool - Red - 25 ft
×5
Hook-up wire spool - Black - 25 ft
×5
Hook-up wire spool - Yellow - 25 ft
×5
480 uF capacitor
×8
Resistor 330 ohm
Resistor 330 ohm
×1

Story

Read more

Code

file_8321.txt

C/C++
And the code to draw that tree.
void drawHarperTree() {
    matrix.fillScreen(LIGHTBLUE);
    matrix.drawPixel(8,1,YELLOW);
    matrix.drawPixel(8,2,GREEN);
    matrix.drawFastHLine(7,3,3,GREEN);
    matrix.drawPixel(6,4,GREEN);
    matrix.drawPixel(7,4,BLUE);
    matrix.drawPixel(8,4,GREEN);
    matrix.drawPixel(9,4,PURPLE);
    matrix.drawFastHLine(5,5,5,GREEN);
    matrix.drawFastHLine(5,6,5,GREEN);
    matrix.drawFastHLine(4,7,8,GREEN);
    matrix.drawFastHLine(4,8,8,GREEN);
    matrix.drawPixel(6,8,PINK);
    matrix.drawFastHLine(3,9,9,GREEN);
    matrix.drawFastHLine(3,10,9,GREEN);
    matrix.drawFastHLine(5,11,4,BROWN);
    matrix.drawFastHLine(5,12,4,BROWN);
    matrix.drawFastHLine(0,13,17,DARKGREEN);
    
    matrix.show();
}

file_8326.txt

C/C++
Code to draw the snowman.
void drawSnowman() {
    matrix.fillScreen(LIGHTBLUE);
    matrix.fillRect(7,0,6,4,BLACK);
    matrix.drawFastHLine(7,4,6,RED);
    matrix.drawFastHLine(5,5,10,BLACK);
    matrix.drawFastHLine(6,6,8,WHITE);
    matrix.drawFastHLine(5,7,10,WHITE);
    matrix.drawPixel(8,7,BLACK);
    matrix.drawPixel(11,7,BLACK);
    matrix.drawFastHLine(5,8,10,WHITE);
    matrix.drawFastHLine(5,9,10,WHITE);
    matrix.drawFastHLine(6,9,2,ROSY);
    matrix.drawFastHLine(9,9,2,ORANGE);
    matrix.drawFastHLine(12,9,2,ROSY);
    matrix.drawFastHLine(5,10,10,WHITE);
    matrix.drawPixel(6,10,ROSY);
    matrix.drawPixel(7,10,BLACK);
    matrix.drawPixel(12,10,BLACK);
    matrix.drawPixel(13,10,ROSY);
    matrix.drawFastHLine(6,11,8,WHITE);
    matrix.drawFastHLine(8,11,4,BLACK);
    matrix.drawFastHLine(7,12,6,WHITE);
    matrix.drawFastHLine(7,13,6,RED);
    matrix.drawPixel(8,13,GREEN);
    matrix.drawPixel(10,13,GREEN);
    matrix.drawPixel(12,13,GREEN);
    
    matrix.show();
}

file_8328.txt

C/C++
Code for drawing the animated coffee cup.
void drawAnimatedCoffee() {
    matrix.fillScreen(BLACK);
    matrix.show();
    
    //DRAW THE CUP FIRST
    //DRAW GRAY 
    matrix.fillRect(4,4,9,9,GRAY);
    matrix.drawFastHLine(5,13,7,GRAY);
    matrix.drawFastHLine(13,6,2,GRAY);
    matrix.drawFastHLine(14,7,2,GRAY);
    matrix.drawFastVLine(15,8,2,GRAY);
    matrix.drawPixel(14,10,GRAY);
    matrix.drawPixel(13,11,GRAY);
    //DRAW RED
    matrix.drawPixel(6,5,RED);
    matrix.drawPixel(10,5,RED);
    matrix.drawFastHLine(5,6,3,RED);
    matrix.drawFastHLine(9,6,3,RED);
    matrix.fillRect(5,7,7,3,RED);
    matrix.drawFastHLine(6,10,5,RED);
    matrix.drawFastHLine(7,11,3,RED);
    matrix.drawPixel(8,12,RED);
    
    //SHOW THE CUP
    matrix.show();
    
    int numAnimations = 5; //Number of animations...
    
    for (int i = 0 ; i < numAnimations ; i++)
    {
        drawCoffeeCupFrame1();
        delay(600);
        drawCoffeeCupFrame2();
        delay(600);
    }

}

void drawCoffeeCupFrame1() {
    //DRAW THE FIRST FRAME OF STEAM
    matrix.fillRect(0,0,17,4,BLACK);
    matrix.drawPixel(5,0,WHITE);
    matrix.drawPixel(4,1,WHITE);
    matrix.drawPixel(5,2,WHITE);
    matrix.drawPixel(4,3,WHITE);
    matrix.drawPixel(8,0,WHITE);
    matrix.drawPixel(7,1,WHITE);
    matrix.drawPixel(8,2,WHITE);
    matrix.drawPixel(7,3,WHITE);
    matrix.drawPixel(11,0,WHITE);
    matrix.drawPixel(10,1,WHITE);
    matrix.drawPixel(11,2,WHITE);
    matrix.drawPixel(10,3,WHITE);
    
    matrix.show();
}

void drawCoffeeCupFrame2() {
    //DRAW THE SECOND FRAME OF STEAM
    matrix.fillRect(0,0,17,4,BLACK);
    matrix.drawPixel(4,0,WHITE);
    matrix.drawPixel(5,1,WHITE);
    matrix.drawPixel(4,2,WHITE);
    matrix.drawPixel(5,3,WHITE);
    matrix.drawPixel(7,0,WHITE);
    matrix.drawPixel(8,1,WHITE);
    matrix.drawPixel(7,2,WHITE);
    matrix.drawPixel(8,3,WHITE);
    matrix.drawPixel(10,0,WHITE);
    matrix.drawPixel(11,1,WHITE);
    matrix.drawPixel(10,2,WHITE);
    matrix.drawPixel(11,3,WHITE);
    
    matrix.show();
}

file_8331.txt

C/C++
As promised here is the full Spark Core code including the web functions for getting the info from the iPad and iPhone apps.
// This #include statement was automatically added by the Spark IDE.
#include "neopixel/neopixel.h"

// This #include statement was automatically added by the Spark IDE.
#include "neomatrix/neomatrix.h"

// This #include statement was automatically added by the Spark IDE.
#include "Adafruit_GFX/Adafruit_GFX.h"

// Color definitions
#define BLUE     0x001F

// IMPORTANT: Set pixel COUNT, PIN and TYPE
#define PIXEL_PIN D6
#define PIXEL_COUNT 238
#define PIXEL_TYPE WS2812B

// I define the pixels as both a strip and a matrix. Mainly because
// I like some of the strip effects from the demo program. I can
// reference either the strip or the matrix in the rest of my code.

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);  // Define as a strip to do some cool rainbow effects.

Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(17, 14, 6,  // Define a NeoMatrix 17 pixels wide by 14
        NEO_MATRIX_BOTTOM     + NEO_MATRIX_RIGHT +         // pixel high on pin 6. Spark core hooked to
        NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG);           // the BOTTOM RIGHT and wired by COLUMNS in 
                                                           // a ZIGZAG pattern. See: http://goo.gl/ci2VhY

// Easier to define all colors needed here.
uint32_t PEACH = matrix.Color(221,171,127);      
uint32_t ROSY = matrix.Color(255,176,193);
uint32_t LIGHTBLUE = matrix.Color(94,185,247);
uint32_t RED = matrix.Color(255,0,0);
uint32_t GREEN = matrix.Color(0,255,0);
uint32_t GRAY = matrix.Color(100,100,100);
uint32_t BROWN = matrix.Color(117,76,41);
uint32_t PURPLE = matrix.Color(152,5,229);
uint32_t DARKGREEN = matrix.Color(12,158,17);
uint32_t PINK = matrix.Color(250,101,148);
uint32_t ORANGE = matrix.Color(241,90,41);
uint32_t YELLOW = matrix.Color(255,242,0);
uint32_t BLACK = matrix.Color(0,0,0);
uint32_t WHITE = matrix.Color(255,255,255);

//Variables needed for when we're doing live drawing.
bool isDrawing = false;
bool startDrawing = false;

void setup() {
    //Register our Spark function here
    Spark.function("showPicture", showPicture);    // Register for the showPicture function from iPhone App
    Spark.function("drawThePixel", drawThePixel);  // Register for the drawPixel function from iPad App
    matrix.begin();

    // This is just a sequence of RED, GREEN, then OFF(BLACK) so I know the screen reset.
    matrix.fillScreen(RED);
    matrix.show();                
    delay(2000);
    matrix.fillScreen(GREEN);
    matrix.show();
    delay(2000);
    matrix.fillScreen(BLACK);
    matrix.show();
}

void loop() {
    
    if (startDrawing) {               // Only way I could consistently get it to clear the screen
        matrix.fillScreen(BLACK);     // was to track a temporaray startDrawing boolean to set the 
        matrix.show();                // display to black the first time we hit the main loop again.
        startDrawing = false;         // Otherwise I would always end up with part of the image that
    }                                 // was displaying before drawing began on the screen.
    
    //If we are not drawing, run the normal routine.
    if(!isDrawing) {                
        normalRoutine();
    }
    
}

// This is my normal routine that just runs through all the different
// images we're created.
void normalRoutine() {
    if (startDrawing) { return; }   // Check before each item whether we have started drawing.
    scrollText("     Merry Christmas!",GREEN,RED);
    if (startDrawing) { return; }
    delay(1000);
    if (startDrawing) { return; }
    drawReindeer();
    if (startDrawing) { return; }
    delay(5000);
    if (startDrawing) { return; }
    drawHarperPresent();
    if (startDrawing) { return; }
    delay(5000);
    if (startDrawing) { return; }
    drawSanta1();
    if (startDrawing) { return; }
    delay(5000);
    if (startDrawing) { return; }
    scrollText("     HO! HO! HO!",GREEN,RED);
    if (startDrawing) { return; }
    delay(1000);
    if (startDrawing) { return; }
    drawHarperTree();
    if (startDrawing) { return; }
    delay(5000);
    if (startDrawing) { return; }
    drawLexiePattern();
    if (startDrawing) { return; }
    delay(5000);
    if (startDrawing) { return; }
    drawAnimatedCoffee();
    if (startDrawing) { return; }
    delay(500);
    if (startDrawing) { return; }
    drawLexieStar();
    if (startDrawing) { return; }
    delay(5000);
    if (startDrawing) { return; }
    scrollText("     We wish you a Merry Christmas!",GREEN,RED);
    if (startDrawing) { return; }
    delay(1000);
    if (startDrawing) { return; }
    drawElfGirl();
    if (startDrawing) { return; }
    delay(5000);
    if (startDrawing) { return; }
    drawTobeyPattern();
    if (startDrawing) { return; }
    delay(5000);
    if (startDrawing) { return; }
    drawSnowman();
    if (startDrawing) { return; }
    delay(5000);
    if (startDrawing) { return; }
    drawHarperH();
    if (startDrawing) { return; }
    delay(5000);
    if (startDrawing) { return; }
    drawAnimatedCoffee();
    if (startDrawing) { return; }
    delay(500);
    if (startDrawing) { return; }
    drawLexieSnowman();
    if (startDrawing) { return; }
    delay(5000);
    if (startDrawing) { return; }
    drawMirandaChevronPattern();
    if (startDrawing) { return; }
    delay(5000);
    if (startDrawing) { return; }
    drawHarperMerry();
    if (startDrawing) { return; }
    delay(5000);
    if (startDrawing) { return; }
    drawMirandaPresents();
    if (startDrawing) { return; }
    delay(5000);
    if (startDrawing) { return; }
    drawHarperJoyJoy();
    if (startDrawing) { return; }
    delay(5000);
    if (startDrawing) { return; }
    drawMirandaTree();
    if (startDrawing) { return; }
    delay(5000);
    if (startDrawing) { return; }
    drawHarperCandyCane();
    if (startDrawing) { return; }
    delay(5000);
    if (startDrawing) { return; }
    drawMirandaPlusPattern();
    if (startDrawing) { return; }
    delay(5000);
    if (startDrawing) { return; }
    drawMirandaPenguin();
    if (startDrawing) { return; }
    delay(5000);
    if (startDrawing) { return; }
    drawMirandaSnowflake();
    if (startDrawing) { return; }
    delay(5000);
}


//Rainbow function from Adafruit Strip Demo.
void rainbow(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256; j++) {
    for(i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel((i+j) & 255));
    }
    strip.show();
    delay(wait);
  }
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}

// Function run when we receive a "showPicture" command from the
// iPhone app. Only a few cases are handled because I haven't expanded
// it to handle all the different pictures.
// Input: the string Command we received.
// Return: An Integer that's passed back through the Spark API to the
//         iPhone app. 0 for false or "Not Displayed"  1 for true or "Displayed"
int showPicture(String command) {
    
    if (isDrawing) {
        return 0;
    }
    
    if (command == "coffeeCup"){
        drawAnimatedCoffee();
        delay(10000);
        return 1;
    }
    else if (command == "elfGirl"){
        drawElfGirl();
        delay(10000);
        return 1;
    }
    else if (command == "reindeer"){
        drawReindeer();
        delay(10000);
        return 1;
    }
    else if (command == "santa1") {
        drawSanta1();
        delay(10000);
        return 1;
    }
    else if (command == "snowman"){
        drawSnowman();
        delay(10000);
        return 1;
    }
    
    return 0;
}

// Function run when we receive a "drawPixel" command from the iPad
// app.
// Input: String Command. iPad sends either "startDrawing", "stopDrawing",
//        "clearDisplay", or a pixel like "x,y,r,g,b"
//        example: "0,0,255,255,255" Pixel 0,0 RGB (255,255,255) or White.

int drawThePixel(String command) {
    if (command == "startDrawing") {
        if (isDrawing) {
            return 2;
        }
        isDrawing = true;
        startDrawing = true;
        matrix.fillScreen(BLACK);
        matrix.show();
        return 1;
    }
    else if (command == "stopDrawing") {
        isDrawing = false;
        return 1;
    }
    else if (command == "clearDisplay") {
        matrix.fillScreen(BLACK);
        matrix.show();
        return 1;
    }
    else
    {
        // Yes I know there has to be a more efficient way of parsing this string. 
        // My "C" programing skills are lacking in the area of string manipulation.
        int commaIndex = command.indexOf(',');
        int secondCommaIndex = command.indexOf(',', commaIndex+1);
        int thirdCommaIndex = command.indexOf(',', secondCommaIndex+1);
        int fourthCommaIndex = command.indexOf(',', thirdCommaIndex+1);
        
        
        String xCoord = command.substring(0,commaIndex);
        String yCoord = command.substring(commaIndex+1, secondCommaIndex);
        String rValue = command.substring(secondCommaIndex+1, thirdCommaIndex);
        String gValue = command.substring(thirdCommaIndex+1, fourthCommaIndex);
        String bValue = command.substring(fourthCommaIndex+1);
        
        matrix.drawPixel(xCoord.toInt(),yCoord.toInt(),matrix.Color(rValue.toInt(),gValue.toInt(),bValue.toInt()));

        // Show three times because once causes weird things...
        // This tripped me up for a long time. If I only did matrix.show()
        // once, the screen would randomly display the wrong pixels and the
        // wrong colors. Then every third pixel command it would draw right.
        // It was very frustrating. I finally realized if I'd send the command
        // three times, it would work as expected with no noticeable issues
        // on the screen...
        matrix.show();
        matrix.show();
        matrix.show();

        return 1;
    }
    return 0;
}

// Scroll text function.  Basis for this function from the following instructable
// by turnturtle. http://goo.gl/l7tvX9
void scrollText(String text, uint32_t backgroundColor, uint32_t textColor) {
    
    matrix.setTextColor(textColor);
    matrix.setTextSize(1);
    matrix.setTextWrap(false);
    
    //String text = "    Merry Christmas!"; // sample text

    const int width = 3; // width of the marquee display (in characters)

    // Loop once through the string

    for (int offset = 0; offset < text.length(); offset++)

    {

        // Construct the string to display for this iteration

        String t = "";

        for (int i = 0; i < width; i++)

        t += text.charAt((offset + i) % text.length());

        // Print the string for this iteration
       // matrix.setTextColor(randomColor());
        matrix.setCursor(0, 3); // display will be halfway down screen

        matrix.print(t);
        
        matrix.show();

        // Short delay so the text doesn't move too fast

        delay(350);
        
        matrix.fillScreen(backgroundColor);
        matrix.show();

    }
    
}

//function to generate a random color. ;)
uint32_t randomColor() {
    uint32_t colorToReturn = matrix.Color(random(0,256),random(0,256),random(0,256));
    return colorToReturn;
}

// This is untested. I just found the setBrightness() function.
// It should fade a color to screen...
void fadeToColor(uint32_t color, uint8_t duration)
{
    // Valid values for setBrightness are 0-16
    for (int i = 0; i <= 16; i++)
    {
        matrix.fillScreen(color);
        matrix.setBrightness(i);
        matrix.show();
        delay(duration / 16);
    }
    
    matrix.setBrightness(16); //Reset brightness for next drawing?
}


// Below here are all the functions to draw the individual pictures.

void drawSanta1() {
    matrix.fillScreen(BLACK);
    matrix.drawFastHLine(10,1,5,RED);
    matrix.drawFastHLine(9,2,7,RED);
    matrix.drawFastHLine(8,3,9,RED);
    matrix.drawFastHLine(6,4,3,RED);
    matrix.drawFastHLine(9,4,8,WHITE);
    matrix.drawPixel(5,5,WHITE);
    matrix.drawPixel(9,5,WHITE);
    matrix.drawPixel(10,5,PEACH);
    matrix.drawPixel(11,5,LIGHTBLUE);
    matrix.drawPixel(12,5,PEACH);
    matrix.drawPixel(13,5,LIGHTBLUE);
    matrix.drawPixel(14,5,PEACH);
    matrix.drawPixel(15,5,WHITE);
    matrix.drawPixel(9,6,WHITE);
    matrix.drawPixel(10,6,ROSY);
    matrix.drawFastHLine(11,6,3,PEACH);
    matrix.drawPixel(14,6,ROSY);
    matrix.drawPixel(15,6,WHITE);
    matrix.drawPixel(9,7,WHITE);
    matrix.drawPixel(10,7,PEACH);
    matrix.drawFastHLine(11,7,3,WHITE);
    matrix.drawPixel(14,7,PEACH);
    matrix.drawPixel(15,7,WHITE);
    matrix.drawFastHLine(9,8,3,WHITE);
    matrix.drawPixel(12,8,PEACH);
    matrix.drawFastHLine(13,8,3,WHITE);
    matrix.drawFastHLine(9,9,7,WHITE);
    matrix.drawFastHLine(10,10,5,WHITE);
    matrix.drawFastHLine(11,11,3,WHITE);
    
    matrix.show();
}

void drawReindeer() {
    matrix.fillScreen(WHITE);
    matrix.drawFastHLine(5,0,3,GRAY);
    matrix.drawFastHLine(10,0,3,GRAY);
    matrix.drawPixel(7,1,GRAY);
    matrix.drawPixel(10,1,GRAY);
    matrix.drawFastHLine(3,2,3,BROWN);
    matrix.drawPixel(7,2,GRAY);
    matrix.drawPixel(10,2,GRAY);
    matrix.drawFastHLine(12,2,3,BROWN);
    matrix.drawFastHLine(2,3,4,BROWN);
    matrix.drawFastHLine(7,3,4,BROWN);
    matrix.drawFastHLine(12,3,4,BROWN);
    matrix.drawFastHLine(6,4,6,BROWN);
    matrix.drawFastHLine(6,5,6,BROWN);
    //Draw whole row for eyes
    matrix.drawFastHLine(6,6,6,BROWN);
    //Draw Eyes
    matrix.drawPixel(7,6,BLACK);
    matrix.drawPixel(10,6,BLACK);
    matrix.drawFastHLine(6,7,6,BROWN);
    matrix.drawFastHLine(6,8,6,BROWN);
    matrix.drawFastHLine(7,9,4,BROWN);
    matrix.drawFastHLine(7,10,4,BROWN);
    matrix.drawFastHLine(7,11,4,BROWN);
    matrix.drawPixel(7,12,BROWN);
    matrix.drawPixel(10,12,BROWN);
    matrix.drawFastHLine(8,12,2,RED);
    matrix.drawFastHLine(8,13,2,BROWN);
    
    matrix.show();
}

void drawHarperTree() {
    matrix.fillScreen(LIGHTBLUE);
    matrix.drawPixel(8,1,YELLOW);
    matrix.drawPixel(8,2,GREEN);
    matrix.drawFastHLine(7,3,3,GREEN);
    matrix.drawPixel(6,4,GREEN);
    matrix.drawPixel(7,4,BLUE);
    matrix.drawPixel(8,4,GREEN);
    matrix.drawPixel(9,4,PURPLE);
    matrix.drawFastHLine(5,5,5,GREEN);
    matrix.drawFastHLine(5,6,5,GREEN);
    matrix.drawFastHLine(4,7,8,GREEN);
    matrix.drawFastHLine(4,8,8,GREEN);
    matrix.drawPixel(6,8,PINK);
    matrix.drawFastHLine(3,9,9,GREEN);
    matrix.drawFastHLine(3,10,9,GREEN);
    matrix.drawFastHLine(5,11,4,BROWN);
    matrix.drawFastHLine(5,12,4,BROWN);
    matrix.drawFastHLine(0,13,17,DARKGREEN);
    
    matrix.show();
}

void drawLexieStar() {
    matrix.fillScreen(BLACK);
    matrix.drawLine(2,0,8,6,YELLOW);
    matrix.drawLine(8,6,14,0,YELLOW);
    matrix.drawLine(4,13,8,8,YELLOW);
    matrix.drawLine(13,13,8,8,YELLOW);
    matrix.drawFastHLine(0,8,17,YELLOW);
    matrix.drawFastVLine(8,0,14,YELLOW);
    
    matrix.show();
}

void drawLexieSnowman() {
    matrix.fillScreen(LIGHTBLUE);
    matrix.drawFastHLine(8,0,2,BLACK);
    matrix.drawFastHLine(8,1,2,PINK);
    matrix.drawFastHLine(5,2,8,BLACK);
    matrix.drawFastHLine(7,3,4,WHITE);
    matrix.drawPixel(7,4,WHITE);
    matrix.drawPixel(10,4,WHITE);
    matrix.drawFastHLine(8,4,2,BLACK);
    matrix.drawFastHLine(7,5,4,WHITE);
    matrix.drawFastHLine(7,6,4,BLACK);
    matrix.drawPixel(3,7,BROWN);
    matrix.drawFastHLine(6,7,6,WHITE);
    matrix.drawPixel(14,7,BROWN);
    matrix.drawFastHLine(2,8,4,BROWN);
    matrix.drawFastHLine(6,8,2,WHITE);
    matrix.drawFastHLine(8,8,2,BLACK);
    matrix.drawFastHLine(10,8,2,WHITE);
    matrix.drawFastHLine(12,8,4,BROWN);
    matrix.drawPixel(3,9,BROWN);
    matrix.drawFastHLine(6,9,2,WHITE);
    matrix.drawFastHLine(8,9,2,BLACK);
    matrix.drawFastHLine(10,9,2,WHITE);
    matrix.drawPixel(14,9,BROWN);
    matrix.drawFastHLine(6,10,2,WHITE);
    matrix.drawFastHLine(8,10,2,BLACK);
    matrix.drawFastHLine(10,10,2,WHITE);
    matrix.drawFastHLine(5,11,8,WHITE);
    matrix.drawFastHLine(5,12,8,WHITE);
    matrix.drawFastHLine(5,13,8,WHITE);
    
    matrix.show();
}

void drawElfGirl() {
    matrix.fillScreen(WHITE);

    //DRAW ALL PEACH
    matrix.fillRect(3,4,12,8,PEACH);
    matrix.fillRect(7,12,4,2,PEACH);
    //DRAW ALL YELLOW
    matrix.fillRect(0,4,2,2,YELLOW);
    //DRAW ALL GREEN
    matrix.drawFastHLine(4,0,9,GREEN);
    matrix.drawFastHLine(3,1,12,GREEN);
    matrix.drawFastHLine(2,2,14,GREEN);
    matrix.drawFastHLine(2,3,3,GREEN);
    //DRAW ALL BROWN
    matrix.drawFastHLine(5,3,11,BROWN);
    matrix.drawFastHLine(2,4,4,BROWN);
    matrix.drawFastHLine(2,5,2,BROWN);
    matrix.drawFastVLine(0,7,2,BROWN);
    matrix.drawFastVLine(1,6,5,BROWN);
    matrix.drawFastVLine(2,4,9,BROWN);
    matrix.drawFastVLine(4,10,2,BROWN);
    matrix.drawPixel(5,11,BROWN);
    matrix.drawPixel(0,12,BROWN);
    matrix.drawPixel(1,13,BROWN);
    matrix.drawFastVLine(15,3,8,BROWN);
    matrix.drawFastVLine(16,4,6,BROWN);
    matrix.drawFastVLine(14,10,3,BROWN);
    matrix.drawPixel(13,11,BROWN);
    matrix.drawPixel(15,13,BROWN);
    matrix.drawPixel(16,12,BROWN);
    //DRAW ALL EYES
    matrix.drawPixel(6,6,LIGHTBLUE);
    matrix.drawPixel(11,6,LIGHTBLUE);
    //DRAW ALL ROSY
    matrix.fillRect(5,8,2,2,ROSY);
    matrix.fillRect(11,8,2,2,ROSY);
    //DRAW ALL RED
    matrix.drawFastHLine(8,10,2,RED);
    
    matrix.show();
}

void drawTobeyPattern() {
    matrix.fillScreen(PINK);
    matrix.drawRect(1,1,15,12,ORANGE);
    matrix.drawRect(6,4,7,5,YELLOW);
    matrix.drawRect(7,5,5,3,PURPLE);
    matrix.drawFastHLine(8,6,3,LIGHTBLUE);
    
    matrix.show();
}

void drawAnimatedCoffee() {
    matrix.fillScreen(BLACK);
    matrix.show();
    
    //DRAW THE CUP FIRST
    //DRAW GRAY 
    matrix.fillRect(4,4,9,9,GRAY);
    matrix.drawFastHLine(5,13,7,GRAY);
    matrix.drawFastHLine(13,6,2,GRAY);
    matrix.drawFastHLine(14,7,2,GRAY);
    matrix.drawFastVLine(15,8,2,GRAY);
    matrix.drawPixel(14,10,GRAY);
    matrix.drawPixel(13,11,GRAY);
    //DRAW RED
    matrix.drawPixel(6,5,RED);
    matrix.drawPixel(10,5,RED);
    matrix.drawFastHLine(5,6,3,RED);
    matrix.drawFastHLine(9,6,3,RED);
    matrix.fillRect(5,7,7,3,RED);
    matrix.drawFastHLine(6,10,5,RED);
    matrix.drawFastHLine(7,11,3,RED);
    matrix.drawPixel(8,12,RED);
    
    //SHOW THE CUP
    matrix.show();
    
    int numAnimations = 5; //Number of animations...
    
    for (int i = 0 ; i < numAnimations ; i++)
    {
        drawCoffeeCupFrame1();
        delay(600);
        drawCoffeeCupFrame2();
        delay(600);
    }

}

void drawCoffeeCupFrame1() {
    //DRAW THE FIRST FRAME OF STEAM
    matrix.fillRect(0,0,17,4,BLACK);
    matrix.drawPixel(5,0,WHITE);
    matrix.drawPixel(4,1,WHITE);
    matrix.drawPixel(5,2,WHITE);
    matrix.drawPixel(4,3,WHITE);
    matrix.drawPixel(8,0,WHITE);
    matrix.drawPixel(7,1,WHITE);
    matrix.drawPixel(8,2,WHITE);
    matrix.drawPixel(7,3,WHITE);
    matrix.drawPixel(11,0,WHITE);
    matrix.drawPixel(10,1,WHITE);
    matrix.drawPixel(11,2,WHITE);
    matrix.drawPixel(10,3,WHITE);
    
    matrix.show();
}

void drawCoffeeCupFrame2() {
    //DRAW THE SECOND FRAME OF STEAM
    matrix.fillRect(0,0,17,4,BLACK);
    matrix.drawPixel(4,0,WHITE);
    matrix.drawPixel(5,1,WHITE);
    matrix.drawPixel(4,2,WHITE);
    matrix.drawPixel(5,3,WHITE);
    matrix.drawPixel(7,0,WHITE);
    matrix.drawPixel(8,1,WHITE);
    matrix.drawPixel(7,2,WHITE);
    matrix.drawPixel(8,3,WHITE);
    matrix.drawPixel(10,0,WHITE);
    matrix.drawPixel(11,1,WHITE);
    matrix.drawPixel(10,2,WHITE);
    matrix.drawPixel(11,3,WHITE);
    
    matrix.show();
}

void drawSnowman() {
    matrix.fillScreen(LIGHTBLUE);
    matrix.fillRect(7,0,6,4,BLACK);
    matrix.drawFastHLine(7,4,6,RED);
    matrix.drawFastHLine(5,5,10,BLACK);
    matrix.drawFastHLine(6,6,8,WHITE);
    matrix.drawFastHLine(5,7,10,WHITE);
    matrix.drawPixel(8,7,BLACK);
    matrix.drawPixel(11,7,BLACK);
    matrix.drawFastHLine(5,8,10,WHITE);
    matrix.drawFastHLine(5,9,10,WHITE);
    matrix.drawFastHLine(6,9,2,ROSY);
    matrix.drawFastHLine(9,9,2,ORANGE);
    matrix.drawFastHLine(12,9,2,ROSY);
    matrix.drawFastHLine(5,10,10,WHITE);
    matrix.drawPixel(6,10,ROSY);
    matrix.drawPixel(7,10,BLACK);
    matrix.drawPixel(12,10,BLACK);
    matrix.drawPixel(13,10,ROSY);
    matrix.drawFastHLine(6,11,8,WHITE);
    matrix.drawFastHLine(8,11,4,BLACK);
    matrix.drawFastHLine(7,12,6,WHITE);
    matrix.drawFastHLine(7,13,6,RED);
    matrix.drawPixel(8,13,GREEN);
    matrix.drawPixel(10,13,GREEN);
    matrix.drawPixel(12,13,GREEN);
    
    matrix.show();
}

void drawMirandaChevronPattern() {
    matrix.fillScreen(GREEN);
    matrix.drawLine(2,0,8,6,RED);
    matrix.drawLine(3,0,8,5,RED);
    matrix.drawLine(4,0,8,4,RED);
    matrix.drawLine(8,4,12,0,RED);
    matrix.drawLine(8,5,13,0,RED);
    matrix.drawLine(8,6,14,0,RED);
    matrix.drawPixel(8,0,RED);
    matrix.drawLine(0,2,8,10,RED);
    matrix.drawLine(0,3,8,11,RED);
    matrix.drawLine(0,4,8,12,RED);
    matrix.drawLine(8,10,16,2,RED);
    matrix.drawLine(8,11,16,3,RED);
    matrix.drawLine(8,12,16,4,RED);
    matrix.drawLine(0,8,5,13,RED);
    matrix.drawLine(0,9,4,13,RED);
    matrix.drawLine(0,10,3,13,RED);
    matrix.drawLine(11,13,16,8,RED);
    matrix.drawLine(12,13,16,9,RED);
    matrix.drawLine(13,13,16,10,RED);
    
    matrix.show();
}

void drawMirandaPlusPattern() {
    matrix.fillScreen(GREEN);
    matrix.drawFastHLine(4,0,2,RED);
    matrix.drawFastHLine(10,0,2,RED);
    matrix.drawPixel(16,0,RED);
    matrix.fillRect(1,1,2,4,RED);
    matrix.fillRect(0,2,4,2,RED);
    matrix.fillRect(7,1,2,4,RED);
    matrix.fillRect(6,2,4,2,RED);
    matrix.fillRect(13,1,2,4,RED);
    matrix.fillRect(12,2,4,2,RED);
    matrix.drawFastVLine(0,6,2,RED);
    matrix.fillRect(4,5,2,4,RED);
    matrix.fillRect(3,6,4,2,RED);
    matrix.fillRect(10,5,2,4,RED);
    matrix.fillRect(9,6,4,2,RED);
    matrix.drawFastVLine(16,5,4,RED);
    matrix.drawFastVLine(15,6,2,RED);
    matrix.fillRect(1,9,2,4,RED);
    matrix.fillRect(0,10,4,2,RED);
    matrix.fillRect(7,9,2,4,RED);
    matrix.fillRect(6,10,4,2,RED);
    matrix.fillRect(13,9,2,4,RED);
    matrix.fillRect(12,10,4,2,RED);
    matrix.drawFastHLine(4,13,2,RED);
    matrix.drawFastHLine(10,13,2,RED);
    matrix.drawPixel(16,13,RED);
    
    matrix.show();
}

void drawMirandaPresents() {
    matrix.fillScreen(WHITE);
    matrix.fillRect(7,0,5,13,YELLOW);
    matrix.fillRect(9,0,2,4,RED);
    matrix.fillRect(8,1,4,2,RED);
    matrix.fillRect(1,9,7,5,RED);
    matrix.fillRect(11,6,5,8,RED);
    matrix.drawFastHLine(1,11,7,GREEN);
    matrix.drawFastVLine(4,8,6,GREEN);
    matrix.drawFastVLine(1,5,3,GREEN);
    matrix.drawFastVLine(2,6,3,GREEN);
    matrix.drawFastVLine(3,7,2,GREEN);
    matrix.drawFastVLine(7,5,3,GREEN);
    matrix.drawFastVLine(6,6,3,GREEN);
    matrix.drawFastVLine(5,7,2,GREEN);
    matrix.drawPixel(15,6,GREEN);
    matrix.drawLine(11,6,15,10,GREEN);
    matrix.drawLine(11,7,15,11,GREEN);
    matrix.drawFastVLine(11,11,3,GREEN);
    matrix.drawFastVLine(12,12,2,GREEN);
    matrix.drawPixel(13,13,GREEN);
    
    matrix.show();
}

void drawMirandaTree() {
    matrix.fillScreen(WHITE);
    matrix.drawFastVLine(8,12,2,BROWN);
    matrix.drawFastHLine(3,11,11,GREEN);
    matrix.drawFastHLine(5,10,7,GREEN);
    matrix.drawFastHLine(4,9,9,GREEN);
    matrix.drawFastHLine(5,8,7,GREEN);
    matrix.drawFastHLine(6,7,5,GREEN);
    matrix.drawFastHLine(5,6,6,GREEN);
    matrix.drawFastHLine(6,5,5,GREEN);
    matrix.drawFastHLine(7,4,3,GREEN);
    matrix.drawFastHLine(6,3,5,GREEN);
    matrix.drawFastHLine(7,2,3,GREEN);
    matrix.drawPixel(8,1,GREEN);
    //Show the green tree.
    matrix.show();
    delay(1000);
    //now put the ornaments on one at a time...
    matrix.drawPixel(4,11,RED);
    matrix.show();
    delay(300);
    matrix.drawPixel(9,5,YELLOW);
    matrix.show();
    delay(300);
    matrix.drawPixel(6,8,LIGHTBLUE);
    matrix.show();
    delay(300);
    matrix.drawPixel(13,11,YELLOW);
    matrix.show();
    delay(300);
    matrix.drawPixel(9,2,RED);
    matrix.show();
    delay(300);
    matrix.drawPixel(7,10,YELLOW);
    matrix.show();
    delay(300);
    matrix.drawPixel(6,5,RED);
    matrix.show();
    delay(300);
    matrix.drawPixel(10,6,LIGHTBLUE);
    matrix.show();
    delay(300);
    matrix.drawPixel(8,7,RED);
    matrix.show();
    delay(300);
    matrix.drawPixel(10,8,YELLOW);
    matrix.show();
    delay(300);
    matrix.drawPixel(11,10,LIGHTBLUE);
    matrix.show();
    delay(300);
    matrix.drawPixel(9,9,RED);
    matrix.show();
    delay(300);
    matrix.drawPixel(7,3,YELLOW);
    matrix.show();
    delay(300);
    //now add the star and fade it...
    matrix.drawPixel(8,0,YELLOW);
    matrix.show();
    
}

void drawMirandaPenguin() {
    matrix.fillScreen(WHITE);
    matrix.drawFastVLine(1,5,4,GRAY);
    matrix.drawFastVLine(2,7,3,GRAY);
    matrix.drawFastVLine(3,4,9,GRAY);
    matrix.drawPixel(4,3,GRAY);
    matrix.drawFastHLine(3,12,10,GRAY);
    matrix.drawFastVLine(12,5,8,GRAY);
    matrix.drawFastVLine(13,7,3,GRAY);
    matrix.drawFastVLine(14,5,4,GRAY);
    matrix.drawFastHLine(7,6,2,ORANGE);
    matrix.drawFastHLine(5,13,2,ORANGE);
    matrix.drawFastHLine(9,13,2,ORANGE);
    matrix.drawFastHLine(10,0,2,LIGHTBLUE);
    matrix.drawFastHLine(4,2,2,LIGHTBLUE);
    matrix.drawFastHLine(6,3,5,LIGHTBLUE);
    matrix.drawFastHLine(11,4,2,LIGHTBLUE);
    matrix.drawFastHLine(8,1,3,PINK);
    matrix.drawFastHLine(6,2,6,PINK);
    matrix.drawFastHLine(11,3,2,PINK);
    matrix.drawPixel(6,5,GREEN);
    matrix.drawPixel(9,5,GREEN);
    
    matrix.show();
}

void drawMirandaSnowflake() {
    matrix.fillScreen(BLACK);
    
    //top from top down
    matrix.drawPixel(8,0,LIGHTBLUE);
    matrix.drawFastHLine(7,1,3,LIGHTBLUE);
    matrix.drawFastHLine(1,2,4,LIGHTBLUE);
    matrix.drawFastHLine(6,2,5,LIGHTBLUE);
    matrix.drawFastHLine(12,2,4,LIGHTBLUE);
    matrix.drawFastHLine(2,3,4,LIGHTBLUE);
    matrix.drawFastHLine(7,3,3,LIGHTBLUE);
    matrix.drawFastHLine(11,3,4,LIGHTBLUE);
    matrix.drawFastHLine(3,4,4,LIGHTBLUE);
    matrix.drawPixel(8,4,LIGHTBLUE);
    matrix.drawFastHLine(10,4,4,LIGHTBLUE);
    matrix.drawPixel(2,5,LIGHTBLUE);
    matrix.drawFastHLine(4,5,4,LIGHTBLUE);
    matrix.drawFastHLine(9,5,4,LIGHTBLUE);
    matrix.drawPixel(14,5,LIGHTBLUE);
    //middle line
    matrix.drawFastHLine(1,6,3,LIGHTBLUE);
    matrix.drawPixel(8,6,LIGHTBLUE);
    matrix.drawFastHLine(13,6,3,LIGHTBLUE);
    //Bottom from bottom up...
    matrix.drawPixel(8,12,LIGHTBLUE);
    matrix.drawFastHLine(7,11,3,LIGHTBLUE);
    matrix.drawFastHLine(1,10,4,LIGHTBLUE);
    matrix.drawFastHLine(6,10,5,LIGHTBLUE);
    matrix.drawFastHLine(12,10,4,LIGHTBLUE);
    matrix.drawFastHLine(2,9,4,LIGHTBLUE);
    matrix.drawFastHLine(7,9,3,LIGHTBLUE);
    matrix.drawFastHLine(11,9,4,LIGHTBLUE);
    matrix.drawFastHLine(3,8,4,LIGHTBLUE);
    matrix.drawPixel(8,8,LIGHTBLUE);
    matrix.drawFastHLine(10,8,4,LIGHTBLUE);
    matrix.drawPixel(2,7,LIGHTBLUE);
    matrix.drawFastHLine(4,7,4,LIGHTBLUE);
    matrix.drawFastHLine(9,7,4,LIGHTBLUE);
    matrix.drawPixel(14,7,LIGHTBLUE);
    
    matrix.show();
    
}

void drawLexieChristmasTree() {
    matrix.fillScreen(ORANGE);
    matrix.fillRect(8,12,2,2,BROWN);
    matrix.drawFastHLine(3,11,12,GREEN);
    matrix.drawPixel(3,10,RED);
    matrix.drawFastHLine(4,10,10,GREEN);
    matrix.drawPixel(14,10,BLUE);
    matrix.drawPixel(4,9,BLUE);
    matrix.drawFastHLine(5,9,8,GREEN);
    matrix.drawPixel(13,9,RED);
    matrix.drawPixel(5,8,RED);
    matrix.drawFastHLine(6,8,6,GREEN);
    matrix.drawPixel(12,8,BLUE);
    matrix.drawPixel(6,7,BLUE);
    matrix.drawFastHLine(7,7,4,GREEN);
    matrix.drawPixel(11,7,RED);
    matrix.drawPixel(7,6,RED);
    matrix.drawFastHLine(8,6,2,GREEN);
    matrix.drawPixel(10,6,BLUE);
    matrix.fillRect(8,4,2,2,YELLOW);
    
    matrix.show();
}

void drawLexiePattern() {
    matrix.fillScreen(GREEN);
    matrix.drawFastVLine(1,0,14,RED);
    matrix.drawFastVLine(3,0,14,RED);
    matrix.drawFastVLine(5,0,14,RED);
    matrix.drawFastVLine(7,0,14,RED);
    matrix.drawFastVLine(9,0,14,RED);
    matrix.drawFastVLine(11,0,14,RED);
    matrix.drawFastVLine(13,0,14,RED);
    matrix.drawFastVLine(15,0,14,RED);
    
    matrix.show();
}

void drawHarperPresent() {
    matrix.fillScreen(BLUE);
    matrix.fillRect(6,6,5,5,GREEN);
    matrix.drawFastHLine(7,5,3,RED);
    matrix.drawPixel(7,4,RED);
    matrix.drawPixel(9,4,RED);
    
    matrix.show();
}

void drawHarperH() {
    matrix.fillScreen(WHITE);
    matrix.drawFastVLine(5,3,2,ORANGE);
    matrix.drawFastVLine(6,3,8,ORANGE);
    matrix.drawFastVLine(7,3,6,ORANGE);
    matrix.drawFastVLine(8,6,3,ORANGE);
    matrix.drawFastVLine(9,3,6,ORANGE);
    matrix.drawFastVLine(10,3,8,ORANGE);
    matrix.drawFastVLine(11,3,2,ORANGE);
    
    matrix.show();
}

void drawHarperMerry() {
    matrix.fillScreen(WHITE);
    
    //M
    matrix.drawFastHLine(2,2,7,ORANGE);
    matrix.drawFastVLine(2,2,3,ORANGE);
    matrix.drawFastVLine(5,2,3,ORANGE);
    matrix.drawFastVLine(8,2,3,ORANGE);
    
    //e
    matrix.drawPixel(10,3,GREEN);
    matrix.drawFastVLine(11,2,6,GREEN);
    matrix.drawPixel(12,7,GREEN);
    matrix.drawFastVLine(13,2,3,GREEN);
    matrix.drawPixel(12,2,GREEN);
    matrix.drawPixel(12,4,GREEN);
    
    //r
    matrix.drawFastVLine(2,6,4,YELLOW);
    matrix.drawFastHLine(2,7,3,YELLOW);
    matrix.drawPixel(4,8,YELLOW);
    
    //r
    matrix.drawFastVLine(6,6,4,ORANGE);
    matrix.drawFastHLine(6,7,3,ORANGE);
    matrix.drawPixel(8,8,ORANGE);
    
    //y
    matrix.drawPixel(10,9,GREEN);
    matrix.drawFastHLine(10,10,3,GREEN);
    matrix.drawFastVLine(12,9,4,GREEN);
    matrix.drawPixel(11,12,GREEN);
    
    matrix.show();
}

void drawHarperJoyJoy() {
    matrix.fillScreen(WHITE);
    
    //First J
    matrix.drawFastHLine(1,1,5,YELLOW);
    matrix.drawFastVLine(3,1,5,YELLOW);
    matrix.drawFastHLine(1,5,3,YELLOW);

    //First o
    matrix.drawRect(7,3,4,4,ORANGE);
...

This file has been truncated, please download it to see its full contents.

Credits

Corey Jones
1 project • 10 followers
Husband and father. IT Administrator. General Tinkerer.

Comments