Hi!
I am trying to scroll a block of text across a segmented LED screen but I am unable to have the entire message scroll across.
I have been able to scroll the letters one at a time and upon reaching the end, the next letter begins. I've also been able to scroll the message across but the letters constantly change as they scroll.
I am trying to achieve this type of scroll:
- - - - - - - c
- - - - - - c o
- - - - - c o d
- - - - c o d e
- - - c o d e -
- - c o d e - -
- c o d e - - -
c o d e - - - -
o d e - - - - -
d e - - - - - -
e - - - - - - -
- - - - - - - -
repeat...
However, I cannot figure out the way to work my increments/decrements in my function.
this is the code i wrote to control the scrolling/increments/decrements but I can't figure out how to write it so to achieve the goal.
Code:
void write_chars(int digit)
{
int position;
int space = 8;
position = NUM_DISPLAYS - 1;
do{
write_letter(digit, position);
position--;
digit++;
write_space(space--);
Sleep(DELAY_TIME);
}while(position > -2 );
}
void write_letter(int ch, int position)
{
static char chars_table[] = {131, 163, 179, 143};
write_display(chars_table[ch], position);
}
void write_space(int position)
{
int pos;
for ( pos = position; pos < NUM_DISPLAYS; pos++ )
{
write_display(SPACE_CH, pos);
}
}
Could someone be kind enough to help/guide me to the solution to this problem? (probably seems too easy but I just can't figure it out. Frustrating.)
thanks..