Simple Text scrolling for the bicolor matrix

This is a function which can be used by the existing demos.

Please take notice that scrolling large text will give you text mismatch because ht1632_putchar and ht1632_plot have the location as byte values. For scrolling you need integer values therefore change byte x, byte y to int x, int y in ht1632_putchar and ht1632_plot.

There is also only RANDOMCOLOR and not MULTICOLOR because the second needs change of the putchar method. And no background color.

Scrolling text
The original Scrolling fumction is by Bill Ho, adapted by roomtek http://code.google.com/p/sure-green-matrix/

Scroll a text from left to right
/*
* scrolltextcolor()
* Scrolls a text string from bottom to up
* Simple function for the original ht1632_putchar method without MULTICOLOR and mo background color
* Original function by Bill Ho
* scrolltextxcolor(y location, string , colorname (RANDOMCOLOR for random color), delaytime in milliseconds)
*/

void scrolltextxcolor(int y,char Str1[ ], byte color, int delaytime){
int messageLength = strlen(Str1)+ 1;
byte showcolor;
int xa = 0;
while (xa (-1 * ( 6*messageLength))) {
for (int i = 0; i < messageLength; i++) {

if (color==4){
showcolor=random(3)+1;
}
else
{
showcolor=color;
}
ht1632_putchar(xpos + (6* i), y,Str1[i],showcolor);
}
delay(delaytime);// reduce speed of scroll
xpos--;
}
xa =1;
}
}

Call in the loop section:
scrolltextxcolor(4,"HAPPY NEW YEAR ",RANDOMCOLOR,30);

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s