Sunday, June 14, 2015

I Love You Matrix

by J.B. Wylzan
Project 15:  The Dot Led Matrix
This project displays the words " I Love You" as it flashes one letter at a time 
scrolling across the matrix display. It also blinks the Heart pattern 3 times
and simulate partially the space invader game.






Block Diagram:



Hardware:
MAX7219 Dot Led Matrix Display
connecting wires
breadboard
Arduino R3 UNO board


Binary Code Refresher:


Cheat Sheet:
Led Dot Matrix X-Y Address Codex


Code # 15:
/*
  iHacklab I Love You Matrix
  powered by Arduino
  modified by Lawsinium

I love you will flash one letter at a time and blink the Heart three times after scrolling. Take note I coded the binary pattern into various approaches. Try to study them and find which one is best for your programming. This example code is public domain.
 */

 // Setup matrix display
 unsigned char m;
 unsigned char n; 

int pinCLK = 11;  // Clock pin of MAX7219 
int pinCS = 10;   // Load pin of MAX7219  
int pinDIN = 12;  // Data pin of MAX7219 

unsigned char disp1[15][8]={
{0x0,0x7c,0x10,0x10,0x10,0x10,0x7c,0x0}, // code for letter I
0, 0, 0x18, 0 , 0, 0, 0, 0, //.
0, 0x24, B00011000, 0 , 0, 0, 0, 0, // .
0, B01100110, B00011000, 0 , 0, 0, 0, 0, // .
0, B01100110, B10011001, 0 , 0, 0, 0, 0, // .
0, B01100110, B10011001, B01000010 , 0, 0, 0, 0, // .
0, B01100110, B10011001, B01000010, B00100100, 0, 0, 0, // .
0, B01100110, B10011001, B01000010, B00100100, B00011000, 0, 0, // 
{0x0,0x44,0x44,0x44,0x44,0x44,0x38,0x0},   // code for letter U
0, 0, 0, 0 , 0, 0, 0, 0, // .
0, B01100110, B10011001, B01000010, B00100100, B00011000, 0, 0, // .
0, 0, 0, 0 , 0, 0, 0, 0, // .
0, B01100110, B10011001, B01000010, B00100100, B00011000, 0, 0, // .
0, 0, 0, 0 , 0, 0, 0, 0, // .
0, B01100110, B10011001, B01000010, B00100100, B00011000, 0, 0, // .
};

void byteWrite(unsigned char DATA) 
{   
            unsigned char m;
   digitalWrite(pinCS,LOW);
   for(m=8;m>=1;m--)
          {  
             digitalWrite(pinCLK,LOW);
             digitalWrite(pinDIN,DATA&0x80);
             DATA = DATA<<1;
             digitalWrite(pinCLK,HIGH);
           }                                 
}

void chipWrite(unsigned char address,unsigned char data)
{
        digitalWrite(pinCS,LOW);
        byteWrite(address);           
        byteWrite(data);                
        digitalWrite(pinCS,HIGH);
}

void Init_chip(void)
{
 chipWrite(0x09, 0x00);       //decode BCD
 chipWrite(0x0a, 0x03);       //brightness 
 chipWrite(0x0b, 0x07);       //scanlimit
 chipWrite(0x0c, 0x01);       //power mode
 chipWrite(0x0f, 0x00);       //test display
}

void setup()
{
  pinMode(pinCLK,OUTPUT);
  pinMode(pinCS,OUTPUT);
  pinMode(pinDIN,OUTPUT);
  delay(50);
  Init_chip();
}

void loop()

   for(n=0;n<15;n++)    
  {
   for(m=1;m<9;m++)
    chipWrite(m,disp1[n][m-1]);
   delay(500);
  }
}
// end Love Matrix  

Challenge: Review what you have learned from Project Binary Counter step by step. The format 
B00000000 means all leds are OFF. The format B11111111 means all leds are ON. Using both formats can turn on and off an led of leds in a particular row or column. the format B00011000 can also be coded as 18 ( 0001 = 1 and 1000 = 8)


Actual Layout:


Procedure:
1. Use the same prototype as shown above
2. Run the Arduino Interface
3. Select File > New
4. Copy Code #15 above
5. Paste Code #15
6. Click File > Save
7. Click Verify
8. Click Upload
9. I love you will flash one letter at a time and blink the Heart three times after scrolling.


Project # 16:  Ultrasonic Sensor


Disclaimer:  We shall not be liable for any loss or damage of whatever nature - direct, indirect, consequential, or otherwise - which may arise as a result of your use of any information on this website. However, if you are interested in using any of the projects for personal or educational purposes, please inform the author by email. 

Public Domain Notice: Copyright (c) 2000. All rights reserved. This article is part of a book entitled iHackRobot. Copies are welcome to be shared or distributed publicly as long proper citations are observed. Please cite as follows: A Journal of a Creative Mind, Joey Lawsin, 1988, USA.


"The Last Human on Earth will no longer be Human." ~ Joey Lawsin
================================================================== 
The Homotronics® and Homodruinos® logos are registered trademarks.
Copyright Biotronics© Inc. iHackRobot®. All Rights Reserved.
Patent Pending. 2000 © ®
 ================================================================== 


No comments:

Post a Comment