Go Down

Topic: how to scroll text on 8x8 dot matrix (Read 457 times) previous topic - next topic

mus2013

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: [Select]




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;

marco_c

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.
Arduino libraries http://arduinocode.codeplex.com<br />Parola for Arduino http://parola.codeplex.com

Go Up