Pages: [1]   Go Down
Author Topic: how to scroll text on 8x8 dot matrix  (Read 447 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi i need your help please !

i wrote this code on arduino and it works good and shows HI on the 8x8 dot matrix now im trying to scroll it?

this is my code ;


Code:



const char font[8] ={
B00000000,
B10010010,
B10010010,
B11110010,
B10010010,
B10010010,
B10010010,
B00000000};   // displays  HI

void setup() {               
 
  DDRD = B11111111;
  DDRB = B11111;
  DDRC = B111;
 
 }


 
void sendbyte(unsigned char scan){
 
         PORTB= ~ font[scan];            // send first 5bits of 1 byte
         PORTC= ~ font[scan] >>5;        // send the last 3 bits of 1 byte
     delay(1);
          PORTB= ~ B00000;             // clear display
          PORTC= ~ B000;               // clear display
}


 
   
void loop() {
  for ( char scan = 0;scan < 8;scan++){
       
          PORTD = 1 << scan;   // scan
            sendbyte(scan);    // send data sync to scaning bits
             
  }
 }

thank you;
Logged

Sydney, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1287
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

How do you want to scroll it? Left or Right? Do you just want to move it off the screen or rotate through?

You need to understand the << and >> operators in C - this will move the bits in a byte/word/long to the left or right by the specified number of positions. Scrolling is just moving bits the way your characters are defined.
Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Pages: [1]   Go Up
Jump to: