The Game of - Life Clock - (GOL)

Life is anything that by it's nature, opposes entropy.



Image of GOL Clock operating


Operation




The Idea

John Conway's Game Of Life has four rules. 1. Any cell with 3 neighbors will become alive. 2. Any living cell with 2 or 3 neighbors will continue to live. 3. any cell with over 3 neighbors will die. 4. Any living cell with less than 2 living neighbors will die. These rules might reflect over population, under population, homeostasis, and reproduction.

Image of GOL Clock operating

The idea was to build a clock that would display the time on a dot-matrix LED display. The time would be displayed on the screen every minute. However, every second between the minutes, the time image would disintegrate according to the rules of John Conway's Game of Life. I used a great GOL consequence generator I found online to help create my glyphs and there preceding iterations here: Bitstorm GOL . If you need a basic walk through of the game of life or other examples of cellular automation, you may want to visit this site as well: GOL Wiki.


Execution

Image of GOL Clock circuit

In the final revision I would like to see three modes of operation: 2D-Array Loop-back, Direct Finite Display, and Arbitrary Finite. 2D-Array Loop-back, is where element 0,0 of the game matrix connects to the upper limit [n][n] of the array, essentially morphing the game grid into a sphere. Direct Finite Display, is simply where the game grid ends where the viewable LED matrix grid ends. Finally, the Arbitrary Finite mode is where the game grid is limited to some width and height, not necessarily with regard to the viewable display size (with regard to the count of array elements x, and y directions).

Image of GOL Clock circuit

So far however I have only written the Arbitrary Finite example. The game array is 2 column elements and 2 row elements larger than the viewable matrix. I did this because it was the easiest code to write, with this I can easily compare any viewable edge matrices to a padding element. Once you view the code below it will become much clearer, I'm not good at explaining these things! I also currently have no way of setting the time except for changing constants and recompiling the code. I will next put in a means of setting the time with a serial terminal, but I will eventually put in switches on the case to set the time. This way I can simply use a USB wall adapter to move the GOL clock from room to room.


In the Future

Please don't judge me from my code. It's practically pseudo-code! I would like to use recursion instead of some of these nested for loops. I would also like to create Boolean arrays and use bit-shifting and one array in future revisions. I might also use the second set of fonts I created (that work better for square LEDs instead of the round ones I am currently using) by placing a block of fogged acrylic over the LED matrix to defuse the light. I placed 550 ohm resistors in series with the row leads to limit the current of each row. This gives me around 9ma at 5 volts for one LED lit. The more LEDs on that multiplexed row that are lit of course, the dimmer the entire row is. This is just the nature of the multiplexed beast. I think I may be able to compensate for this however, by counting the number of LEDs lit per row at a time and adjusting the POV dwell time to compensate brightness.


The Build

Image of GOL Clock case
Image of GOL Clock case

The Code

Click to Download Source



Image of mBed outputs

        /* GOL LED Matrix Clock - Alex McAlpine - www.BrainLubeOnline.com *******************************************************************
 * 10-03-2013 ***********************************************************************************************************************
 * Every second, the time display disintegrates following the rules of John Conway's Game of Life using the pixels of the display. **
 * Clock iterates by the second. ****************************************************************************************************
 * Every minute the clock resets the image to the time and restarts the disintegration process. *************************************
 * There are three modes of operation (Ideally) : ***********************************************************************************
 * ******************************** 2D-Array Loopback *******************************************************************************
 * ************************************ Ex. Element [0][0] of array is directly effected by the last element[*][*] of the ***********
 * ************************************ GOL matrix array. ***************************************************************************
 * ******************************** Direct Finite Display Array *********************************************************************
 * ************************************ The limits of the display are the limits of the GOL matrix array. ***************************
 * ******************************** Arbitrary Finite Array **************************************************************************
 * ************************************ The limits of the game matrix are user defined. *********************************************
 * The rules may be found here: http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life ************************************************
 * http://www.bitstorm.org/gameoflife/ is a GREAT site I used for character development to view the disintegrations. ****************
 * I Would like to 86 the FORs for recusion, and use pointers for the glyphs; also use boolean arrays or bitshifting where possible.*
 * I might add a fogged acrylic block to the LED Array to defuse the light. *********************************************************
 * Dislikes: ************************************************************************************************************************
 * *************** I have the same problem with varying brightnesses of different combinations of LED pixels. This is becuase I *****
 * *************** have my current limiting resistors on each of the row pins, therefore if I light more than one LED on that row ***
 * *************** (for example, multiple columns) the LEDs must share the limited current, a common problem. ***********************
 * *************** The solution would be to add a decrementing dwell time that counts the number of elements currently "on" *********
 * *********************************************************************************************************************************/

//Timing of the disintegrations is not prefect, but the time will reset to the correct minute when iterations are complete.
//This means the clock will display time +-1 minute of the calculated time at this point.

//Preprocessor Directives
#include "mbed.h"

DigitalOut RowOut[10]= {p5,p6,p7,p8,p9,p10,p11,p12,p13,p14};
DigitalOut ColOut[16]= {p15,p16,p17,p18,p19,p20,p21,p22,p30,p29,p28,p27,p26,p25,p24,p23};
Serial pc(USBTX, USBRX); // TX, RX - Serial Debug

// Global Variables
short int GridArray[12][18];            //Later initialized to 0; //Grid for LED Matrix
short int rowindex, colindex;           //2-D loop index variables
unsigned short Glyphs[10][5][4];       //3-D Array for Number Glyphs
char day[16];                           //Char time register
int m = 0;                              //Minute Register
int h = 0;                              //Hour Register
unsigned short GridCellNext[10][16];   //Register for Next Grid Itteration


const short int high = 1;
const short int low = 0;
const float dwell = .004;               //For Persistance of Vision (POV) Timing

void parser(void);
void ArrayInit(void);
void CharSetter(int h, int m);
void GOLprocessor(void);





int main()
{
struct tm t;            //Time Function Allocations      //Set the time by the variables below
    t.tm_sec = 00;          // 0-59
    t.tm_min = 36;          // 0-59
    t.tm_hour = 1;          // 0-23
    t.tm_mday = 17;          // 1-31
    t.tm_mon = 10;          // 0-11
    t.tm_year = 113;        // year since 1900

    time_t seconds = mktime(&t); // convert to timestamp
    set_time(mktime(&t));        //SET RTC Time
    
    ArrayInit();
    
    while(1) 
    {
        time_t seconds = time(NULL);
        strftime(day,16,"%M", localtime(&seconds));     //get time into 'day' char
        m = atoi(day);                                 //convert to int (minute)
        strftime(day,16,"%H", localtime(&seconds));    //get time into 'day' char
        h = atoi(day);                                 //convert to int (hour)
        CharSetter(h,m);                                //Arranges Glyphs to show the time
        parser();
        parser();
        GOLprocessor();
    
    
    
    
    
    
    
    




    }//end big main() while
}//end main()
















void GOLprocessor()
{

    for(int i = 0; i < 59; i++) {

        for(rowindex = 0; rowindex < 10; rowindex++) { //Reset GridCellNext
            for(colindex = 0; colindex < 16; colindex++) {
                GridCellNext[rowindex][colindex] = 0;
            }
        }

        for(rowindex = 1; rowindex < 11; rowindex++) {  //Charge GridCellNext with judgement Math for GOL Tests
            for(colindex = 1; colindex < 17; colindex++) {
                GridCellNext[rowindex - 1][colindex - 1] = GridArray[rowindex -1][colindex -1]+ GridArray[rowindex -1][colindex]+ GridArray[rowindex -1][colindex +1]+ GridArray[rowindex][colindex -1]+ GridArray[rowindex][colindex+1]+ GridArray[rowindex +1][colindex -1]+ GridArray[rowindex +1][colindex]+ GridArray[rowindex +1][colindex +1];
            }
        }

        for(rowindex = 0; rowindex < 10; rowindex++) { //Conduct GOL Rule Tests and record onto GridArray
            for(colindex = 0; colindex < 16; colindex++) {
                if(GridCellNext[rowindex][colindex] == 3) {
                    GridArray[rowindex +1][colindex+1] = 1;
                }
                if(GridCellNext[rowindex][colindex] > 3) {
                    GridArray[rowindex +1][colindex+1] = 0;
                }
                if(GridCellNext[rowindex][colindex] < 2 ) {
                    GridArray[rowindex +1][colindex+1] = 0;
                }
                if(GridCellNext[rowindex][colindex] == 2 || GridCellNext[rowindex][colindex] == 3 ) {
                    if(GridArray[rowindex +1][colindex+1] != 0) {   //If there is no life, then there will remain no life.
                        GridArray[rowindex +1][colindex +1] = 1;
                    }
                }

            }
        }

        parser();
    }//END for


}//END GOLprocessor()








void CharSetter(int h,int m)                    
{

    pc.printf("\033[1;48HTime: %d:%d",h,m);
    pc.printf("\033[2;1H");
    
    if(h >=10) {
        h = h -10;
        for(rowindex = 0; rowindex < 5; rowindex++) {
            for(colindex = 0; colindex < 4; colindex++) {
                GridArray[rowindex+1][colindex+1]= Glyphs[1][rowindex][colindex];
                //pc.printf("%d",Glyphs[1][rowindex][colindex]);
            }//end for

            for(colindex = 0; colindex < 4; colindex++) {
                GridArray[rowindex+1][colindex+5]= Glyphs[h][rowindex][colindex];
                //pc.printf("%d",Glyphs[h][rowindex][colindex]);
            }//end for

            if(m >= 10) {
                short int decm = m / 10;
                for(colindex = 0; colindex < 4; colindex++) {
                    GridArray[rowindex+1][colindex+9]= Glyphs[decm][rowindex][colindex];
                    //pc.printf("%d",Glyphs[decm][rowindex][colindex]);
                }//end for

                short int smallm = m - (decm*10);
                for(colindex = 0; colindex < 4; colindex++) {
                    GridArray[rowindex+1][colindex+13]= Glyphs[smallm][rowindex][colindex];
                    //pc.printf("%d",Glyphs[smallm][rowindex][colindex]);
                }//end for
            }//end if
            else {
                for(colindex = 0; colindex < 4; colindex++) {
                    GridArray[rowindex+1][colindex+9]= Glyphs[0][rowindex][colindex];
                    //pc.printf("%d",Glyphs[0][rowindex][colindex]);
                }//end for

                for(colindex = 0; colindex < 4; colindex++) {
                    GridArray[rowindex+1][colindex+13]= Glyphs[m][rowindex][colindex];
                    //pc.printf("%d",Glyphs[m][rowindex][colindex]);
                }//end for
            }//end else
            //pc.printf("\n\r");
        }//end for
    }//end first big if
    else {
        for(rowindex = 0; rowindex < 5; rowindex++) { //Reset GridCellNext
            for(colindex = 0; colindex < 4; colindex++) {
                GridArray[rowindex+1][colindex+1]= Glyphs[0][rowindex][colindex];
                //pc.printf("%d",Glyphs[0][rowindex][colindex]);
            }//end for

            for(colindex = 0; colindex < 4; colindex++) {
                GridArray[rowindex+1][colindex+5]= Glyphs[h][rowindex][colindex];
                //pc.printf("%d",Glyphs[h][rowindex][colindex]);
            }//end for

            if(m >= 10) {
                short int decm = m / 10;

                for(colindex = 0; colindex < 4; colindex++) {
                    GridArray[rowindex+1][colindex+9]= Glyphs[decm][rowindex][colindex];
                    //pc.printf("%d",Glyphs[decm][rowindex][colindex]);
                }//end for

                short int smallm = m - (decm *10);
                for(colindex = 0; colindex < 4; colindex++) {
                    GridArray[rowindex+1][colindex+13]= Glyphs[smallm][rowindex][colindex];
                    //pc.printf("%d",Glyphs[smallm][rowindex][colindex]);
                }//end for
            }//end if
            else {
                for(colindex = 0; colindex < 4; colindex++) {
                    GridArray[rowindex+1][colindex+9]= Glyphs[0][rowindex][colindex];
                    //pc.printf("%d",Glyphs[0][rowindex][colindex]);
                }//end for

                for(colindex = 0; colindex < 4; colindex++) {
                    GridArray[rowindex+1][colindex+13]= Glyphs[m][rowindex][colindex];
                    //pc.printf("%d",Glyphs[m][rowindex][colindex]);
                }//end for
            }//end else
            //pc.printf("\n\r");
        }//end for
    }//end big else

//pc.printf("\033[2;1H");


}//END CharSetter 




void ArrayInit()
{
    pc.baud(115200);         //Debug Port
    pc.printf("\033[1;1H - GOL Matrix Clock - www.BrainLubeOnline.com\n\rInitializing\r");

    //'0' Character
    Glyphs[0][0][0] = 1;
    Glyphs[0][1][0] = 1;
    Glyphs[0][2][0] = 1;
    Glyphs[0][3][0] = 1;
    Glyphs[0][4][0] = 1;
    Glyphs[0][0][1] = 1;
    Glyphs[0][1][1] = 0;
    Glyphs[0][2][1] = 0;
    Glyphs[0][3][1] = 0;
    Glyphs[0][4][1] = 1;
    Glyphs[0][0][2] = 1;
    Glyphs[0][1][2] = 1;
    Glyphs[0][2][2] = 1;
    Glyphs[0][3][2] = 1;
    Glyphs[0][4][2] = 1;
    //Space after Char
    Glyphs[0][0][3] = 0;
    Glyphs[0][1][3] = 0;
    Glyphs[0][2][3] = 0;
    Glyphs[0][3][3] = 0;
    Glyphs[0][4][3] = 0;

    //'1' Character
    Glyphs[1][0][0] = 0;
    Glyphs[1][1][0] = 1;
    Glyphs[1][2][0] = 0;
    Glyphs[1][3][0] = 0;
    Glyphs[1][4][0] = 1;
    Glyphs[1][0][1] = 1;
    Glyphs[1][1][1] = 1;
    Glyphs[1][2][1] = 1;
    Glyphs[1][3][1] = 1;
    Glyphs[1][4][1] = 1;
    Glyphs[1][0][2] = 0;
    Glyphs[1][1][2] = 0;
    Glyphs[1][2][2] = 0;
    Glyphs[1][3][2] = 0;
    Glyphs[1][4][2] = 1;
    //Space after Char
    Glyphs[1][0][3] = 0;
    Glyphs[1][1][3] = 0;
    Glyphs[1][2][3] = 0;
    Glyphs[1][3][3] = 0;
    Glyphs[1][4][3] = 0;

    //'2' Character
    Glyphs[2][0][0] = 1;
    Glyphs[2][1][0] = 0;
    Glyphs[2][2][0] = 1;
    Glyphs[2][3][0] = 1;
    Glyphs[2][4][0] = 1;
    Glyphs[2][0][1] = 1;
    Glyphs[2][1][1] = 0;
    Glyphs[2][2][1] = 1;
    Glyphs[2][3][1] = 0;
    Glyphs[2][4][1] = 1;
    Glyphs[2][0][2] = 1;
    Glyphs[2][1][2] = 1;
    Glyphs[2][2][2] = 1;
    Glyphs[2][3][2] = 0;
    Glyphs[2][4][2] = 1;
    //Space after Char
    Glyphs[2][0][3] = 0;
    Glyphs[2][1][3] = 0;
    Glyphs[2][2][3] = 0;
    Glyphs[2][3][3] = 0;
    Glyphs[2][4][3] = 0;

    //'3' Character
    Glyphs[3][0][0] = 1;
    Glyphs[3][1][0] = 0;
    Glyphs[3][2][0] = 0;
    Glyphs[3][3][0] = 0;
    Glyphs[3][4][0] = 1;
    Glyphs[3][0][1] = 1;
    Glyphs[3][1][1] = 0;
    Glyphs[3][2][1] = 1;
    Glyphs[3][3][1] = 0;
    Glyphs[3][4][1] = 1;
    Glyphs[3][0][2] = 1;
    Glyphs[3][1][2] = 1;
    Glyphs[3][2][2] = 1;
    Glyphs[3][3][2] = 1;
    Glyphs[3][4][2] = 1;
    //Space after Char
    Glyphs[3][0][3] = 0;
    Glyphs[3][1][3] = 0;
    Glyphs[3][2][3] = 0;
    Glyphs[3][3][3] = 0;
    Glyphs[3][4][3] = 0;

    //'4' Character
    Glyphs[4][0][0] = 1;
    Glyphs[4][1][0] = 1;
    Glyphs[4][2][0] = 1;
    Glyphs[4][3][0] = 0;
    Glyphs[4][4][0] = 0;
    Glyphs[4][0][1] = 0;
    Glyphs[4][1][1] = 0;
    Glyphs[4][2][1] = 1;
    Glyphs[4][3][1] = 0;
    Glyphs[4][4][1] = 0;
    Glyphs[4][0][2] = 1;
    Glyphs[4][1][2] = 1;
    Glyphs[4][2][2] = 1;
    Glyphs[4][3][2] = 1;
    Glyphs[4][4][2] = 1;
    //Space after Char
    Glyphs[4][0][3] = 0;
    Glyphs[4][1][3] = 0;
    Glyphs[4][2][3] = 0;
    Glyphs[4][3][3] = 0;
    Glyphs[4][4][3] = 0;

    //'5' Character
    Glyphs[5][0][0] = 1;
    Glyphs[5][1][0] = 1;
    Glyphs[5][2][0] = 1;
    Glyphs[5][3][0] = 0;
    Glyphs[5][4][0] = 1;
    Glyphs[5][0][1] = 1;
    Glyphs[5][1][1] = 0;
    Glyphs[5][2][1] = 1;
    Glyphs[5][3][1] = 0;
    Glyphs[5][4][1] = 1;
    Glyphs[5][0][2] = 1;
    Glyphs[5][1][2] = 0;
    Glyphs[5][2][2] = 1;
    Glyphs[5][3][2] = 1;
    Glyphs[5][4][2] = 1;
    //Space after Char
    Glyphs[5][0][3] = 0;
    Glyphs[5][1][3] = 0;
    Glyphs[5][2][3] = 0;
    Glyphs[5][3][3] = 0;
    Glyphs[5][4][3] = 0;

    //'6' Character
    Glyphs[6][0][0] = 1;
    Glyphs[6][1][0] = 1;
    Glyphs[6][2][0] = 1;
    Glyphs[6][3][0] = 1;
    Glyphs[6][4][0] = 1;
    Glyphs[6][0][1] = 1;
    Glyphs[6][1][1] = 0;
    Glyphs[6][2][1] = 1;
    Glyphs[6][3][1] = 0;
    Glyphs[6][4][1] = 1;
    Glyphs[6][0][2] = 1;
    Glyphs[6][1][2] = 0;
    Glyphs[6][2][2] = 1;
    Glyphs[6][3][2] = 1;
    Glyphs[6][4][2] = 1;
    //Space after Char
    Glyphs[6][0][3] = 0;
    Glyphs[6][1][3] = 0;
    Glyphs[6][2][3] = 0;
    Glyphs[6][3][3] = 0;
    Glyphs[6][4][3] = 0;

    //'7' Character
    Glyphs[7][0][0] = 1;
    Glyphs[7][1][0] = 0;
    Glyphs[7][2][0] = 0;
    Glyphs[7][3][0] = 0;
    Glyphs[7][4][0] = 0;
    Glyphs[7][0][1] = 1;
    Glyphs[7][1][1] = 0;
    Glyphs[7][2][1] = 0;
    Glyphs[7][3][1] = 0;
    Glyphs[7][4][1] = 0;
    Glyphs[7][0][2] = 1;
    Glyphs[7][1][2] = 1;
    Glyphs[7][2][2] = 1;
    Glyphs[7][3][2] = 1;
    Glyphs[7][4][2] = 1;
    //Space after Char
    Glyphs[7][0][3] = 0;
    Glyphs[7][1][3] = 0;
    Glyphs[7][2][3] = 0;
    Glyphs[7][3][3] = 0;
    Glyphs[7][4][3] = 0;

    //'8' Character
    Glyphs[8][0][0] = 1;
    Glyphs[8][1][0] = 1;
    Glyphs[8][2][0] = 1;
    Glyphs[8][3][0] = 1;
    Glyphs[8][4][0] = 1;
    Glyphs[8][0][1] = 1;
    Glyphs[8][1][1] = 0;
    Glyphs[8][2][1] = 1;
    Glyphs[8][3][1] = 0;
    Glyphs[8][4][1] = 1;
    Glyphs[8][0][2] = 1;
    Glyphs[8][1][2] = 1;
    Glyphs[8][2][2] = 1;
    Glyphs[8][3][2] = 1;
    Glyphs[8][4][2] = 1;
    //Space after Char
    Glyphs[8][0][3] = 0;
    Glyphs[8][1][3] = 0;
    Glyphs[8][2][3] = 0;
    Glyphs[8][3][3] = 0;
    Glyphs[8][4][3] = 0;

    //'9' Character
    Glyphs[9][0][0] = 1;
    Glyphs[9][1][0] = 1;
    Glyphs[9][2][0] = 1;
    Glyphs[9][3][0] = 0;
    Glyphs[9][4][0] = 0;
    Glyphs[9][0][1] = 1;
    Glyphs[9][1][1] = 0;
    Glyphs[9][2][1] = 1;
    Glyphs[9][3][1] = 0;
    Glyphs[9][4][1] = 0;
    Glyphs[9][0][2] = 1;
    Glyphs[9][1][2] = 1;
    Glyphs[9][2][2] = 1;
    Glyphs[9][3][2] = 1;
    Glyphs[9][4][2] = 1;
    //Space after Char
    Glyphs[9][0][3] = 0;
    Glyphs[9][1][3] = 0;
    Glyphs[9][2][3] = 0;
    Glyphs[9][3][3] = 0;
    Glyphs[9][4][3] = 0;

    /* This is a special stylized font set for square-cell led arrays:

        //'0' Character
        Glyphs[0][0][0] = 0;
        Glyphs[0][1][0] = 1;
        Glyphs[0][2][0] = 1;
        Glyphs[0][3][0] = 1;
        Glyphs[0][4][0] = 1;
        Glyphs[0][0][1] = 1;
        Glyphs[0][1][1] = 0;
        Glyphs[0][2][1] = 0;
        Glyphs[0][3][1] = 0;
        Glyphs[0][4][1] = 1;
        Glyphs[0][0][2] = 1;
        Glyphs[0][1][2] = 1;
        Glyphs[0][2][2] = 1;
        Glyphs[0][3][2] = 1;
        Glyphs[0][4][2] = 0;
        //Space after Char
        Glyphs[0][0][3] = 0;
        Glyphs[0][1][3] = 0;
        Glyphs[0][2][3] = 0;
        Glyphs[0][3][3] = 0;
        Glyphs[0][4][3] = 0;

        //'1' Character
        Glyphs[1][0][0] = 0;
        Glyphs[1][1][0] = 1;
        Glyphs[1][2][0] = 0;
        Glyphs[1][3][0] = 0;
        Glyphs[1][4][0] = 1;
        Glyphs[1][0][1] = 1;
        Glyphs[1][1][1] = 1;
        Glyphs[1][2][1] = 1;
        Glyphs[1][3][1] = 1;
        Glyphs[1][4][1] = 1;
        Glyphs[1][0][2] = 0;
        Glyphs[1][1][2] = 0;
        Glyphs[1][2][2] = 0;
        Glyphs[1][3][2] = 0;
        Glyphs[1][4][2] = 1;
        //Space after Char
        Glyphs[1][0][3] = 0;
        Glyphs[1][1][3] = 0;
        Glyphs[1][2][3] = 0;
        Glyphs[1][3][3] = 0;
        Glyphs[1][4][3] = 0;

        //'2' Character
        Glyphs[2][0][0] = 1;
        Glyphs[2][1][0] = 0;
        Glyphs[2][2][0] = 0;
        Glyphs[2][3][0] = 1;
        Glyphs[2][4][0] = 1;
        Glyphs[2][0][1] = 1;
        Glyphs[2][1][1] = 0;
        Glyphs[2][2][1] = 1;
        Glyphs[2][3][1] = 0;
        Glyphs[2][4][1] = 1;
        Glyphs[2][0][2] = 0;
        Glyphs[2][1][2] = 1;
        Glyphs[2][2][2] = 1;
        Glyphs[2][3][2] = 0;
        Glyphs[2][4][2] = 1;
        //Space after Char
        Glyphs[2][0][3] = 0;
        Glyphs[2][1][3] = 0;
        Glyphs[2][2][3] = 0;
        Glyphs[2][3][3] = 0;
        Glyphs[2][4][3] = 0;

        //'3' Character
        Glyphs[3][0][0] = 1;
        Glyphs[3][1][0] = 0;
        Glyphs[3][2][0] = 0;
        Glyphs[3][3][0] = 0;
        Glyphs[3][4][0] = 1;
        Glyphs[3][0][1] = 1;
        Glyphs[3][1][1] = 0;
        Glyphs[3][2][1] = 1;
        Glyphs[3][3][1] = 0;
        Glyphs[3][4][1] = 1;
        Glyphs[3][0][2] = 0;
        Glyphs[3][1][2] = 1;
        Glyphs[3][2][2] = 1;
        Glyphs[3][3][2] = 1;
        Glyphs[3][4][2] = 1;
        //Space after Char
        Glyphs[3][0][3] = 0;
        Glyphs[3][1][3] = 0;
        Glyphs[3][2][3] = 0;
        Glyphs[3][3][3] = 0;
        Glyphs[3][4][3] = 0;

        //'4' Character
        Glyphs[4][0][0] = 1;
        Glyphs[4][1][0] = 1;
        Glyphs[4][2][0] = 1;
        Glyphs[4][3][0] = 0;
        Glyphs[4][4][0] = 0;
        Glyphs[4][0][1] = 0;
        Glyphs[4][1][1] = 0;
        Glyphs[4][2][1] = 1;
        Glyphs[4][3][1] = 0;
        Glyphs[4][4][1] = 0;
        Glyphs[4][0][2] = 0;
        Glyphs[4][1][2] = 1;
        Glyphs[4][2][2] = 1;
        Glyphs[4][3][2] = 1;
        Glyphs[4][4][2] = 1;
        //Space after Char
        Glyphs[4][0][3] = 0;
        Glyphs[4][1][3] = 0;
        Glyphs[4][2][3] = 0;
        Glyphs[4][3][3] = 0;
        Glyphs[4][4][3] = 0;

        //'5' Character
        Glyphs[5][0][0] = 1;
        Glyphs[5][1][0] = 1;
        Glyphs[5][2][0] = 1;
        Glyphs[5][3][0] = 0;
        Glyphs[5][4][0] = 1;
        Glyphs[5][0][1] = 1;
        Glyphs[5][1][1] = 0;
        Glyphs[5][2][1] = 1;
        Glyphs[5][3][1] = 0;
        Glyphs[5][4][1] = 1;
        Glyphs[5][0][2] = 1;
        Glyphs[5][1][2] = 0;
        Glyphs[5][2][2] = 1;
        Glyphs[5][3][2] = 1;
        Glyphs[5][4][2] = 0;
        //Space after Char
        Glyphs[5][0][3] = 0;
        Glyphs[5][1][3] = 0;
        Glyphs[5][2][3] = 0;
        Glyphs[5][3][3] = 0;
        Glyphs[5][4][3] = 0;

        //'6' Character
        Glyphs[6][0][0] = 0;
        Glyphs[6][1][0] = 1;
        Glyphs[6][2][0] = 1;
        Glyphs[6][3][0] = 1;
        Glyphs[6][4][0] = 1;
        Glyphs[6][0][1] = 1;
        Glyphs[6][1][1] = 0;
        Glyphs[6][2][1] = 1;
        Glyphs[6][3][1] = 0;
        Glyphs[6][4][1] = 1;
        Glyphs[6][0][2] = 1;
        Glyphs[6][1][2] = 0;
        Glyphs[6][2][2] = 1;
        Glyphs[6][3][2] = 1;
        Glyphs[6][4][2] = 1;
        //Space after Char
        Glyphs[6][0][3] = 0;
        Glyphs[6][1][3] = 0;
        Glyphs[6][2][3] = 0;
        Glyphs[6][3][3] = 0;
        Glyphs[6][4][3] = 0;

        //'7' Character
        Glyphs[7][0][0] = 1;
        Glyphs[7][1][0] = 0;
        Glyphs[7][2][0] = 0;
        Glyphs[7][3][0] = 0;
        Glyphs[7][4][0] = 1;
        Glyphs[7][0][1] = 1;
        Glyphs[7][1][1] = 0;
        Glyphs[7][2][1] = 0;
        Glyphs[7][3][1] = 1;
        Glyphs[7][4][1] = 0;
        Glyphs[7][0][2] = 1;
        Glyphs[7][1][2] = 1;
        Glyphs[7][2][2] = 1;
        Glyphs[7][3][2] = 0;
        Glyphs[7][4][2] = 0;
        //Space after Char
        Glyphs[7][0][3] = 0;
        Glyphs[7][1][3] = 0;
        Glyphs[7][2][3] = 0;
        Glyphs[7][3][3] = 0;
        Glyphs[7][4][3] = 0;

        //'8' Character
        Glyphs[8][0][0] = 1;
        Glyphs[8][1][0] = 1;
        Glyphs[8][2][0] = 1;
        Glyphs[8][3][0] = 1;
        Glyphs[8][4][0] = 0;
        Glyphs[8][0][1] = 1;
        Glyphs[8][1][1] = 0;
        Glyphs[8][2][1] = 1;
        Glyphs[8][3][1] = 0;
        Glyphs[8][4][1] = 1;
        Glyphs[8][0][2] = 0;
        Glyphs[8][1][2] = 1;
        Glyphs[8][2][2] = 1;
        Glyphs[8][3][2] = 1;
        Glyphs[8][4][2] = 1;
        //Space after Char
        Glyphs[8][0][3] = 0;
        Glyphs[8][1][3] = 0;
        Glyphs[8][2][3] = 0;
        Glyphs[8][3][3] = 0;
        Glyphs[8][4][3] = 0;

        //'9' Character
        Glyphs[9][0][0] = 1;
        Glyphs[9][1][0] = 1;
        Glyphs[9][2][0] = 1;
        Glyphs[9][3][0] = 0;
        Glyphs[9][4][0] = 0;
        Glyphs[9][0][1] = 1;
        Glyphs[9][1][1] = 0;
        Glyphs[9][2][1] = 1;
        Glyphs[9][3][1] = 0;
        Glyphs[9][4][1] = 1;
        Glyphs[9][0][2] = 0;
        Glyphs[9][1][2] = 1;
        Glyphs[9][2][2] = 1;
        Glyphs[9][3][2] = 1;
        Glyphs[9][4][2] = 0;
        //Space after Char
        Glyphs[9][0][3] = 0;
        Glyphs[9][1][3] = 0;
        Glyphs[9][2][3] = 0;
        Glyphs[9][3][3] = 0;
        Glyphs[9][4][3] = 0;
    */
    
    
    

    for(int index = 0; index < 10; index++) { //Multiplexed Row Pins Initialized to LOW
        RowOut[index] = low;

    }

    for(int index = 0; index < 16; index++) { //Multiplexed Column Pins Initialized to LOW
        ColOut[index] = high;

    }

    for(rowindex = 0; rowindex < 12; rowindex++) { //Initialize Grid Array
        for(colindex = 0; colindex < 18; colindex++) {
            GridArray[rowindex][colindex] = 0;
        }
    }
}//END ArrayInit()




void parser(void)
{
    for(int i = 0; i < 21; i++) {
        for(rowindex = 1; rowindex < 11; rowindex++) { //Parse Matrix for Display Pins
            RowOut[rowindex - 1]= high;              //Multiplex Itteration for 1-Pin Row to HIGH
            for(colindex = 1; colindex < 17; colindex++) {
                ColOut[colindex - 1]= !GridArray[rowindex][colindex];       //Invert results
            }
            wait(dwell);                     //Dwell to be adjusted for Human POV
            RowOut[rowindex - 1]= low;
        }
    }//END big for
}//End Parser()

    



Back to BrainLubeOnline.com