Working demos: demo16x24scroll and demo3216bicolorscroll

demo16x24scroll.zip
demo3216bicolorscroll.zip

This are the demo files copy them into your Arduino directory. The files are adaptions of Bill Westfield (“WestfW”) and FlorinC code, only functions are changed for showing bitmaps and fonts.

You can copy any function in your program they use the ht1632_plot function of Bill Westfield. For scrolling you need integer values therefore change byte x, byte y to int x, int y in ht1632_plot.

Advertisements
Posted in Uncategorized | Leave a comment

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);

Posted in Uncategorized | Leave a comment

New colors for the bicolor matrix

We have three colors more
1.) RANDOMCOLOR will change the color for the whole bitmap or char
2.) MULTICOLOR for all functions, this varies the color for each point
3.) RANDOMCOLUMNCOLOR will draw columns in random colors
Additionally we have two different colors a foreground and a background color.

Posted in Uncategorized | Leave a comment

Using fonts and scrolling text for the bicolor matrix with arduino

This an adaption of the original function by by Bill Westfield (“WestfW”).

Most fonts, also the used in the original function, use 2 dimension arrays, i.e. the font is separated for each char with a brace, that is not bad but you can’t call different fonts with different sizes from one function, at least I’m such an idiot who can’t.

Now we have colors and not like the matrix only 3 colors, black doesn’t count.
We have three colors more
1.) RANDOMCOLOR will change the color for the whole char
2.) MULTICOLOR for all functions, this varies the color for each point
3.) RANDOMCOLUMNCOLOR will draw chars with columns in random colors
Additionally we have two different colors a foreground and a background color.

ht1632_putcharsize
An adaption. you can use fonts up to 24 lines, also you can increase the size with integer values. You need to add the number of columns of the font in your header e.g.:
// insert here the number of columns of your font files
// the compiler will comment how large the number of columns
// should be
#define NCOLUMNS 8

/*
* Copy a character glyph from the myfont data structure to
* display memory, with its upper left at the given coordinate
* This is unoptimized and simply uses plot() to draw each dot.
* Slightly adopted for using fonts with more rows then 8
* ht1632_putcharsizecolor(x location, y location , char , size as integer, colorname (RANDOMCOLOR for random color), name of the font array, umber of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory font arrays)
*/
void ht1632_putcharsizecolor(int x, int y,unsigned char c, char size, byte color, byte secondcolor, unsigned char fontname[][NCOLUMNS], int columncountfont, char rowcountfont, char oddeven)
{

byte dots, dots2,dots3, cc,cc2, cc3, rr, g, t, t3, divisor;
byte maximumdrawfont, showcolor,showsecondcolor; //128 for the large fonts (=8x8 and 12x8), 64 for all smaller ones
if (rowcountfont<=7)
maximumdrawfont=64;
else
maximumdrawfont=128;
showcolor=color;
showsecondcolor=secondcolor;
if (showcolor==4){
showcolor=random(3)+1;
}
else
{
showcolor=showcolor;}

if (showsecondcolor==4){
showsecondcolor=random(3)+1;
}
else
{
showsecondcolor=showsecondcolor;
}

for (byte col=0; col<columncountfont*size ; col++) {
// Addressing the right 8 lines because 'The Dot Factory' starts from the bottom, all others from top
if (rowcountfont 8 && rowcountfont 16 && rowcountfont <=24){
if (oddeven=='T'){
g=0;
t=1;
t3=2;
}
else {
g=2;
t=1;
t3=0;
}
divisor=3;
cc=col/size*divisor+g;
cc2=col/size*divisor+t;
cc3=col/size*divisor+t3;
dots = pgm_read_byte_near(&fontname[c][cc]);
dots2 = pgm_read_byte_near(&fontname[c][cc2]);
dots3 = pgm_read_byte_near(&fontname[c][cc3]);

}
if (color==6){
showcolor=random(3)+1;
}
else
{
showcolor=showcolor;
}
if (secondcolor==6){
showsecondcolor=random(3)+1;
}
else
{
showsecondcolor=showsecondcolor;
}
for (byte row=0; row >rr))
plot(x+col, y+row, showcolor);
else
plot(x+col, y+row, showsecondcolor);
if (divisor>=2){
if (dots2 & (maximumdrawfont>>rr))
plot(x+col, y+rowcountfont/divisor+row, showcolor);
else
plot(x+col, y+rowcountfont/divisor+row, showsecondcolor);
}
if (divisor>=3){
if (dots3& (maximumdrawfont>>rr))
plot(x+col, y+2*rowcountfont/divisor+row, showcolor);
else
plot(x+col, y+2*rowcountfont/divisor+row, showsecondcolor);
}
}
}
}

Call in the loop section:
//Draws a char
// ht1632_putcharsizecolor(x location, y location , char , size as integer, name of the font array, umber of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory font arrays)
ht1632_putcharsizecolor(0,0,'B',2,MULTICOLOR,BLACK,my2font,8,8,'G');

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

/*
* scrolltextsizexcolor()
* Scrolls a text string from left to right
* Original function by Bill Ho
* scrolltextxsizexcolor(y location, string , size as integer, colorname (RANDOMCOLOR for random color), name of the second color (instead of BLACK), name of the font array, umber of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory font arrays, delaytime in milliseconds)
*/
void scrolltextsizexcolor(int y,char Str1[ ], char size, byte color, byte secondcolor, unsigned char fontname[][NCOLUMNS], int columncountfont, char rowcountfont, char oddeven, int delaytime){
int messageLength = strlen(Str1)+ 1;
byte showcolor,showsecondcolor;
int xa = 0;
while (xa (-1 * ( columncountfont*size* messageLength))) {
for (int i = 0; i < messageLength; i++) {
if (color==4){
showcolor=random(3)+1;
}
else
{
showcolor=color;}
if (secondcolor==4){
showsecondcolor=random(3)+1;
}
else
{
showsecondcolor=secondcolor;
}
ht1632_putcharsizecolor(xpos + (columncountfont*size * i), y,Str1[i], size, showcolor, showsecondcolor, fontname, columncountfont, rowcountfont, oddeven);

}
delay(delaytime);// reduce speed of scroll
xpos--;
}
xa =1;
}
}

Call in the loop section:
// Scrolls the String from left to right
// Scrolls the String from left to right
// scrolltextxsize(y location, string , size as integer, colorname (RANDOMCOLOR for random color), name of the second color (instead of BLACK),name of the font array, umber of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory font arrays, delaytime in milliseconds)
scrolltextsizex(1,"Donaudampfschifffahrtskapitaenskajuete ",1,my2font,8,8,'G',30); //longest German word, don't forget the space chars on the end

Scroll from bottom to up

/*
* scrolltextysize()
* Scrolls a text string from bottom to up
* Original function by Bill Ho
* scrolltextxsizeycolor(y location, string , size as integer, colorname (RANDOMCOLOR for random color), name of the second color (instead of BLACK), name of the font array, number of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory font arrays, delaytime in milliseconds)
*/
void scrolltextsizey(int x,char Str1[ ], char size, byte color, byte secondcolor, unsigned char fontname[][NCOLUMNS], int columncountfont, char rowcountfont, char oddeven, int delaytime){
int messageLength = strlen(Str1)+ 1;
byte showcolor,showsecondcolor;
int ya = 0;
while (ya (-1 * ( columncountfont*size* messageLength))) {
for (int i = 0; i < messageLength; i++) {
if (color==4){
showcolor=random(3)+1;
}
else
{
showcolor=color;}
if (secondcolor==4){
showsecondcolor=random(3)+1;
}
else
{
showsecondcolor=secondcolor;
}
ht1632_putcharsizecolor(x,ypos + (columncountfont*size * i),Str1[i], size, showcolor, showsecondcolor, fontname, columncountfont, rowcountfont, oddeven);

}
delay(delaytime);// reduce speed of scroll
ypos--;
}
ya =1;
}
}

Call in the loop section:
// Scrolls the String from left to right
// scrolltextxsize(x location, string , size as integer, colorname (RANDOMCOLOR for random color), name of the second color (instead of BLACK), name of the font array, umber of columns, number of rows, 'G' for Gimp or 'T' for The Dot Facto

scrolltextsizey(0,"Test ",1,GREEN, 0,my2font,8,8,'G',0); //don't forget the space chars on the end

Posted in Uncategorized | Leave a comment

Using Bitmaps and scroll them for bicolor matrix

This an adaption of the original function by by Bill Westfield (“WestfW”)
Now we have colors and not like the matrix only 3 colors, black doesn’t count.
We have two colors more
1.) RANDOMCOLOR will change the color for the whole bitmap
2.) MULTICOLOR for all functions, this varies the color for each point
3.) RANDOMCOLUMNCOLOR will draw columns in random colors
Additionally we have two different colors a foreground and a background color.

Sorry, in the first draw I forget to add the “color” to ht1632_putbigbitmapcolor, for distinction it is better to rename this function.

ht1632_putbigbitmapcolor
This function can show bitmaps up to 80 lines. The only thing you need to know are the name, width and height of the bitmap

/*
* Copy a bitmap from any XBM bitmap file
* Maximum possible lines are 80 lines
* Restrictions=Amount of SRAM is the maximum drawing space
* There will be a fix for the restrictons hopefully in the future
* Slightly adopted for using bitmaps
* ht1632_putbigbitmapcolor(x location, y location , bitmapname , colorname (RANDOMCOLOR for random color), name of the second color (instead of BLACK), number of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory bitmap arrays).
*/

void ht1632_putbigbitmapcolor(int x, int y, byte color, byte secondcolor, unsigned char * bitmapname, int columncountbitmap, byte rowcountbitmap, char oddeven)
{
unsigned short dots, dots2,dots3,dots4,dots5, dots6, dots7,dots8,dots9,dots10, cc,cc2,cc3, cc4,cc5,cc6,cc7,cc8, cc9,cc10, g,t,t3,t4,t5,t6,t7,t8,t9,t10, divisor, startcolum, endcolumn;

byte maximumdrawbitmap=128, showcolor, showsecondcolor; //128 for the large fonts (=8x8 and 12x8), 64 for all smaller ones
if (x>=0){
startcolum=0;
}
else{
startcolum=-x;
}

if ((-x+X_MAX+2)>=columncountbitmap){
endcolumn=columncountbitmap;
}
else{
endcolumn=-x+X_MAX+2;
}
showcolor=color;
showsecondcolor=secondcolor;
if (showcolor==4){
showcolor=random(3)+1;
}
else
{
showcolor=showcolor;}

if (showsecondcolor==4){
showsecondcolor=random(3)+1;
}
else
{
showsecondcolor=showsecondcolor;
}

for (unsigned short col=startcolum; col<endcolumn; col++) {
//for (byte col=0; col<columncountbitmap; col++) {
// Addressing the right 8 lines because 'The Dot Factory' starts from the bottom, all others from top
if (rowcountbitmap 8 && rowcountbitmap 16 && rowcountbitmap 24 && rowcountbitmap 32 && rowcountbitmap 40 && rowcountbitmap 48 && rowcountbitmap 56 && rowcountbitmap 64 && rowcountbitmap 72 && rowcountbitmap <=80){
if (oddeven=='T'){
g=0;
t=1;
t3=2;
t4=3;
t5=4;
t6=5;
t7=6;
t8=7;
t9=8;
t10=9;
}
else {
g=9;
t=8;
t3=7;
t4=6;
t5=5;
t6=4;
t7=3;
t8=2;
t9=1;
t10=0;
}
divisor=10;
cc=col*divisor+g;
cc2=col*divisor+t;
cc3=col*divisor+t3;
cc4=col*divisor+t4;
cc5=col*divisor+t5;
cc6=col*divisor+t6;
cc7=col*divisor+t7;
cc8=col*divisor+t8;
cc9=col*divisor+t9;
cc10=col*divisor+t10;
dots = pgm_read_byte_near(&bitmapname[cc]);
dots2 = pgm_read_byte_near(&bitmapname[cc2]);
dots3 = pgm_read_byte_near(&bitmapname[cc3]);
dots4 = pgm_read_byte_near(&bitmapname[cc4]);
dots5 = pgm_read_byte_near(&bitmapname[cc5]);
dots6 = pgm_read_byte_near(&bitmapname[cc6]);
dots7 = pgm_read_byte_near(&bitmapname[cc7]);
dots8 = pgm_read_byte_near(&bitmapname[cc8]);
dots9 = pgm_read_byte_near(&bitmapname[cc9]);
dots10 = pgm_read_byte_near(&bitmapname[cc10]);
}

if (color==6){
showcolor=random(3)+1;
}
else
{
showcolor=showcolor;
}
if (secondcolor==6){
showsecondcolor=random(3)+1;
}
else
{
showsecondcolor=showsecondcolor;
}

for (byte row=0; row >row))

plot(x+col, y+row, showcolor);
else

plot(x+col, y+row, showsecondcolor);

if (divisor>=2){
if (dots2 & (maximumdrawbitmap>>row))
plot(x+col, y+rowcountbitmap/divisor+row, showcolor);
else
plot(x+col, y+rowcountbitmap/divisor+row, showsecondcolor);
}
if (divisor>=3){
if (dots3 & (maximumdrawbitmap>>row))
plot(x+col, y+2*rowcountbitmap/divisor+row, showcolor);
else
plot(x+col, y+2*rowcountbitmap/divisor+row, showsecondcolor);
}
if (divisor>=4){
if (dots4 & (maximumdrawbitmap>>row))
plot(x+col, y+3*rowcountbitmap/divisor+row, showcolor);
else
plot(x+col, y+3*rowcountbitmap/divisor+row, showsecondcolor);
}
if (divisor>=5){
if (dots5 & (maximumdrawbitmap>>row))
plot(x+col, y+4*rowcountbitmap/divisor+row, showcolor);
else
plot(x+col, y+4*rowcountbitmap/divisor+row, showsecondcolor);
}
if (divisor>=6){
if (dots6& (maximumdrawbitmap>>row))
plot(x+col, y+5*rowcountbitmap/divisor+row, showcolor);
else
plot(x+col, y+5*rowcountbitmap/divisor+row, showsecondcolor);
}
if (divisor>=7){
if (dots7& (maximumdrawbitmap>>row))
plot(x+col, y+6*rowcountbitmap/divisor+row, showcolor);
else
plot(x+col, y+6*rowcountbitmap/divisor+row, showsecondcolor);
}
if (divisor>=8){
if (dots8& (maximumdrawbitmap>>row))
plot(x+col, y+7*rowcountbitmap/divisor+row, showcolor);
else
plot(x+col, y+7*rowcountbitmap/divisor+row, showsecondcolor);
}
if (divisor>=9){
if (dots9& (maximumdrawbitmap>>row))
plot(x+col, y+8*rowcountbitmap/divisor+row, showcolor);
else
plot(x+col, y+8*rowcountbitmap/divisor+row, showsecondcolor);
}
if (divisor>=10){
if (dots10& (maximumdrawbitmap>>row))
plot(x+col, y+9*rowcountbitmap/divisor+row, showcolor);
else
plot(x+col, y+9*rowcountbitmap/divisor+row, showsecondcolor);
}

}
}
}

Call in the loop section:
//ht1632_putbigbitmapcolor(x location, y location , bitmapname , colorname (RANDOMCOLOR for random color), name of the second color (instead of BLACK), number of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory bitmap arrays).
ht1632_putbigbitmapcolor(0,0 , RED, GREEN, lady_bits, 23,72, 'T');

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

Scroll a bitmap from left to right

/*
* scrollbitmapx()
* Scrolls a bitmap from left to right
* Original function by Bill Ho
* scrollbitmapx (x location, colorname (RANDOMCOLOR for random color), name of the second color (instead of BLACK), bitmapnae , number of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory bitmap arrays, delaytime in milliseconds).
*/

void scrollbitmapxcolor(int y, byte color, byte secondcolor,unsigned char * bitmapname,int columncountbitmap, byte rowcountbitmap,char oddeven,int delaytime) {
byte showcolor,showsecondcolor;
int xa = 0;
while (xa (-1 * ( columncountbitmap))) {
for (int i = 0; i < 1; i++) {
if (color==4){
showcolor=random(3)+1;
}
else
{
showcolor=color;}
if (secondcolor==4){
showsecondcolor=random(3)+1;
}
else
{
showsecondcolor=secondcolor;
}

ht1632_putbigbitmapcolor(xpos + (columncountbitmap *i), y, showcolor, showsecondcolor, bitmapname , columncountbitmap,rowcountbitmap, oddeven);
}
delay(delaytime);// reduce speed of scroll
xpos--;
}
xa =1;
}
}

Call in the loop section:
// Scrolls the Bitmap from left to right
// scrollbitmapx (x location,bitmapnae , number of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory bitmap arrays, delaytime in milliseconds).
scrollbitmapxcolor (0,RANDOMCOLOR, ORANGE,lady_bits, 23,72,'T', 30);

Scroll a bitmap from bottom to up
/*
* scrollbitmapy()
* Scrolls a bitmap from bottom to up
* Original function by Bill Ho
* scrollbitmapy (y location, colorname (RANDOMCOLOR for random color), name of the second color (instead of BLACK), bitmapnae , number of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory bitmap arrays, delaytime in milliseconds).
*/
void scrollbitmapycolor(int x,byte color, byte secondcolor,unsigned char * bitmapname ,int columncountbitmap, byte rowcountbitmap,char oddeven, int delaytime) {
byte showcolor,showsecondcolor;
int ya = 0;
while (ya (-1 * ( rowcountbitmap))) {
for (int i = 0; i < 1; i++) {
if (color==4){
showcolor=random(3)+1;
}
else
{
showcolor=color;}
if (secondcolor==4){
showsecondcolor=random(3)+1;
}
else
{
showsecondcolor=secondcolor;
}
ht1632_putbigbitmapcolor(x, ypos + ( rowcountbitmap *i), showcolor, showsecondcolor, bitmapname ,columncountbitmap,rowcountbitmap, oddeven);
}
delay(delaytime);// reduce speed of scroll
ypos --;
}
ya = 1;
}
}

Call in the loop section:
//Scrolls a bitmap from bottom to up
// scrollbitmapx (x location,bitmapnae , number of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory bitmap arrays, delaytime in milliseconds).
scrollbitmapycolor (0,MULTICOLOR, 0,lady_bits , 23,72,'T', 30);

Posted in Uncategorized | Leave a comment

Using fonts and scrolling text for the single color matrix with arduino

This an adaption of the original function by by Bill Westfield (“WestfW”).

Most fonts, also the used in the original function, use 2 dimension arrays, i.e. the font is separated for each char with a brace, that is not bad but you can’t call different fonts with different sizes from one function, at least I’m such an idiot who can’t.
I have also made a ht1632_putcharsize1D function with scrolling function which could call from an array like provided from TheDotFactory but this scrolls right but afterwards it loads endless char from the font. not usefull.

ht1632_putcharsize
An adaption. you can use fonts up to 24 lines, also you can increase the size with integer values. You need to add the number of columns of the font in your header e.g.:
// insert here the number of columns of your font files
// the compiler will comment how large the number of columns
// should be
#define NCOLUMNS 8

/*
* Copy a character glyph from the myfont data structure to
* display memory, with its upper left at the given coordinate
* This is unoptimized and simply uses plot() to draw each dot.
* Slightly adopted for using fonts with more rows then 8
* ht1632_putcharsize(x location, y location , char , size as integer, name of the font array, umber of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory font arrays)
*/
void ht1632_putcharsize(int x, int y,unsigned char c, char size, unsigned char fontname[][NCOLUMNS], int columncountfont, char rowcountfont, char oddeven)
{

byte dots, dots2,dots3, cc,cc2, cc3, rr, g, t, t3, divisor;
byte maximumdrawfont; //128 for the large fonts (=8x8 and 12x8), 64 for all smaller ones
if (rowcountfont<=7)
maximumdrawfont=64;
else
maximumdrawfont=128;
for (byte col=0; col<columncountfont*size ; col++) {
// Addressing the right 8 lines because 'The Dot Factory' starts from the bottom, all others from top
if (rowcountfont 8 && rowcountfont 16 && rowcountfont <=24){
if (oddeven=='T'){
g=0;
t=1;
t3=2;
}
else {
g=2;
t=1;
t3=0;
}
divisor=3;
cc=col/size*divisor+g;
cc2=col/size*divisor+t;
cc3=col/size*divisor+t3;
dots = pgm_read_byte_near(&fontname[c][cc]);
dots2 = pgm_read_byte_near(&fontname[c][cc2]);
dots3 = pgm_read_byte_near(&fontname[c][cc3]);

}
for (byte row=0; row >rr))
plot(x+col, y+row, 1);
else
plot(x+col, y+row, 0);
if (divisor>=2){
if (dots2 & (maximumdrawfont>>rr))
plot(x+col, y+rowcountfont/divisor+row, 1);
else
plot(x+col, y+rowcountfont/divisor+row, 0);
}
if (divisor>=3){
if (dots3& (maximumdrawfont>>rr))
plot(x+col, y+2*rowcountfont/divisor+row, 1);
else
plot(x+col, y+2*rowcountfont/divisor+row, 0);
}
}
}
}

Call in the loop section:
//Draws a char
// ht1632_putcharsize(x location, y location , char , size as integer, name of the font array, umber of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory font arrays)
ht1632_putcharsize(0,0,'B',2,my2font,8,8,'G');

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

/*
* scrolltextxsize()
* Scrolls a text string from left to right
* Original function by Bill Ho
* scrolltextxsize(y location, string , size as integer, name of the font array, umber of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory font arrays, delaytime in milliseconds)
*/
void scrolltextsizex(int y,char Str1[ ], char size, unsigned char fontname[][NCOLUMNS], int columncountfont, char rowcountfont, char oddeven, int delaytime){
int messageLength = strlen(Str1)+ 1;
int xa = 0;
while (xa (-1 * ( columncountfont*size* messageLength))) {
for (int i = 0; i < messageLength; i++) {
ht1632_putcharsize(xpos + (columncountfont*size * i), y,Str1[i], size, fontname, columncountfont, rowcountfont, oddeven);

}
delay(delaytime);// reduce speed of scroll
xpos--;
}
xa =1;
}
}

Call in the loop section:
// Scrolls the String from left to right
// scrolltextxsize(y location, string , size as integer, name of the font array, umber of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory font arrays, delaytime in milliseconds)
scrolltextsizex(1,"Donaudampfschifffahrtskapitaenskajuete ",1,my2font,8,8,'G',30); //longest German word, don't forget the space chars on the end

Scroll from bottom to up

/*
* scrolltextysize()
* Scrolls a text string from bottom to up
* Original function by Bill Ho
* scrolltextxsize(y location, string , size as integer, name of the font array, umber of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory font arrays, delaytime in milliseconds)
*/
void scrolltextsizey(int x,char Str1[ ], char size, unsigned char fontname[][NCOLUMNS], int columncountfont, char rowcountfont, char oddeven, int delaytime){
int messageLength = strlen(Str1)+ 1;
int ya = 0;
while (ya (-1 * ( columncountfont*size* messageLength))) {
for (int i = 0; i < messageLength; i++) {
ht1632_putcharsize(x,ypos + (columncountfont*size * i),Str1[i], size, fontname, columncountfont, rowcountfont, oddeven);

}
delay(delaytime);// reduce speed of scroll
ypos--;
}
ya =1;
}
}

Call in the loop section:
// scrolltextsizey(x location, string , size as integer, name of the font array, umber of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory font arrays, delaytime in milliseconds)
scrolltextsizey(0,"Test ",1,my2font,8,8,'G',0); //don't forget the space chars on the end
delay(LONGDELAY);

Posted in Uncategorized | Leave a comment

Using Bitmaps and scroll them for single color matrix

This an adaption of the original function by by Bill Westfield (“WestfW”)

ht1632_putbigbitmap
This function can show bitmaps up to 80 lines. The only thing you need to know are the name, width and height of the bitmap

/*
* Copy a bitmap from any XBM bitmap file
* Maximum possible lines are 80 lines
* Restrictions=Amount of SRAM is the maximum drawing space
* There will be a fix for the restrictons hopefully in the future
* Slightly adopted for using bitmaps
* ht1632_putbigbitmap(x location, y location , bitmapname , number of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory bitmap arrays).
*/
void ht1632_putbigbitmap(int x, int y, unsigned char * bitmapname,int columncountbitmap, byte rowcountbitmap, char oddeven)
{
unsigned short dots, dots2,dots3,dots4,dots5, dots6, dots7,dots8,dots9,dots10, cc,cc2,cc3, cc4,cc5,cc6,cc7,cc8, cc9,cc10, g,t,t3,t4,t5,t6,t7,t8,t9,t10, divisor, startcolum, endcolumn;

byte maximumdrawbitmap=128; //128 for the large fonts (=8x8 and 12x8), 64 for all smaller ones
if (x>=0){
startcolum=0;
}
else{
startcolum=-x;
}

if ((-x+X_MAX+2)>=columncountbitmap){
endcolumn=columncountbitmap;
}
else{
endcolumn=-x+X_MAX+2;
}

for (unsigned short col=startcolum; col<endcolumn; col++) {
//for (byte col=0; col<columncountbitmap; col++) {
// Addressing the right 8 lines because 'The Dot Factory' starts from the bottom, all others from top
if (rowcountbitmap 8 && rowcountbitmap 16 && rowcountbitmap 24 && rowcountbitmap 32 && rowcountbitmap 40 && rowcountbitmap 48 && rowcountbitmap 56 && rowcountbitmap 64 && rowcountbitmap 72 && rowcountbitmap <=80){
if (oddeven=='T'){
g=0;
t=1;
t3=2;
t4=3;
t5=4;
t6=5;
t7=6;
t8=7;
t9=8;
t10=9;
}
else {
g=9;
t=8;
t3=7;
t4=6;
t5=5;
t6=4;
t7=3;
t8=2;
t9=1;
t10=0;
}
divisor=10;
cc=col*divisor+g;
cc2=col*divisor+t;
cc3=col*divisor+t3;
cc4=col*divisor+t4;
cc5=col*divisor+t5;
cc6=col*divisor+t6;
cc7=col*divisor+t7;
cc8=col*divisor+t8;
cc9=col*divisor+t9;
cc10=col*divisor+t10;
dots = pgm_read_byte_near(&bitmapname[cc]);
dots2 = pgm_read_byte_near(&bitmapname[cc2]);
dots3 = pgm_read_byte_near(&bitmapname[cc3]);
dots4 = pgm_read_byte_near(&bitmapname[cc4]);
dots5 = pgm_read_byte_near(&bitmapname[cc5]);
dots6 = pgm_read_byte_near(&bitmapname[cc6]);
dots7 = pgm_read_byte_near(&bitmapname[cc7]);
dots8 = pgm_read_byte_near(&bitmapname[cc8]);
dots9 = pgm_read_byte_near(&bitmapname[cc9]);
dots10 = pgm_read_byte_near(&bitmapname[cc10]);
}

for (byte row=0; row >row))
plot(x+col, y+row, 1);
else
plot(x+col, y+row, 0);
if (divisor>=2){
if (dots2 & (maximumdrawbitmap>>row))
plot(x+col, y+rowcountbitmap/divisor+row, 1);
else
plot(x+col, y+rowcountbitmap/divisor+row, 0);
}
if (divisor>=3){
if (dots3 & (maximumdrawbitmap>>row))
plot(x+col, y+2*rowcountbitmap/divisor+row, 1);
else
plot(x+col, y+2*rowcountbitmap/divisor+row, 0);
}
if (divisor>=4){
if (dots4 & (maximumdrawbitmap>>row))
plot(x+col, y+3*rowcountbitmap/divisor+row, 1);
else
plot(x+col, y+3*rowcountbitmap/divisor+row, 0);
}
if (divisor>=5){
if (dots5 & (maximumdrawbitmap>>row))
plot(x+col, y+4*rowcountbitmap/divisor+row, 1);
else
plot(x+col, y+4*rowcountbitmap/divisor+row, 0);
}
if (divisor>=6){
if (dots6& (maximumdrawbitmap>>row))
plot(x+col, y+5*rowcountbitmap/divisor+row, 1);
else
plot(x+col, y+5*rowcountbitmap/divisor+row, 0);
}
if (divisor>=7){
if (dots7& (maximumdrawbitmap>>row))
plot(x+col, y+6*rowcountbitmap/divisor+row, 1);
else
plot(x+col, y+6*rowcountbitmap/divisor+row, 0);
}
if (divisor>=8){
if (dots8& (maximumdrawbitmap>>row))
plot(x+col, y+7*rowcountbitmap/divisor+row, 1);
else
plot(x+col, y+7*rowcountbitmap/divisor+row, 0);
}
if (divisor>=9){
if (dots9& (maximumdrawbitmap>>row))
plot(x+col, y+8*rowcountbitmap/divisor+row, 1);
else
plot(x+col, y+8*rowcountbitmap/divisor+row, 0);
}
if (divisor>=10){
if (dots10& (maximumdrawbitmap>>row))
plot(x+col, y+9*rowcountbitmap/divisor+row, 1);
else
plot(x+col, y+9*rowcountbitmap/divisor+row, 0);
}

}
}
}

This function could be called in the loop function with:
// Draws the Bitmap at 0,0
// ht1632_putbigbitmap(x location, y location , bitmapname , number of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory bitmap arrays).
ht1632_putbigbitmap(0,0 , lady_bits , 23,65, 'T');

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

Scroll a bitmap from left to right

/*
* scrollbitmapx()
* Scrolls a bitmap from left to right
* Original function by Bill Ho
* scrollbitmapx (x location,bitmapnae , number of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory bitmap arrays, delaytime in milliseconds).
*/
void scrollbitmapx(int y, unsigned char * bitmapname,int columncountbitmap, byte rowcountbitmap,char oddeven,int delaytime) {

int xa = 0;
while (xa (-1 * ( columncountbitmap))) {
for (int i = 0; i < 1; i++) {
ht1632_putbigbitmap(xpos + (columncountbitmap *i), y, bitmapname , columncountbitmap,rowcountbitmap, oddeven);
}
delay(delaytime);// reduce speed of scroll
xpos--;
}
xa =1;
}
}

This function could be called in the loop function with:
// Scrolls the Bitmap from left to right
// scrollbitmapx (x location,bitmapnae , number of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory bitmap arrays, delaytime in milliseconds).
scrollbitmapx (0,lady_bits , 23,65, 'T', 30);

Scrolling a bitmap from bottom to up

/*
* scrollbitmapy()
* Scrolls a bitmap from bottom to up
* Original function by Bill Ho
* scrollbitmapy (y location,bitmapnae , number of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory bitmap arrays, delaytime in milliseconds).
*/
void scrollbitmapy(int x,unsigned char * bitmapname ,int columncountbitmap, byte rowcountbitmap,char oddeven, int delaytime) {
int ya = 0;
while (ya (-1 * ( rowcountbitmap))) {
for (int i = 0; i < 1; i++) {
ht1632_putbigbitmap(x, ypos + ( rowcountbitmap *i), bitmapname , columncountbitmap,rowcountbitmap, oddeven);
}
delay(delaytime);// reduce speed of scroll
ypos --;
}
ya = 1;
}
}

This function could be called in the loop function with:
//Scrolls a bitmap from bottom to up
// scrollbitmapx (x location,bitmapnae , number of columns, number of rows, 'G' for Gimp or 'T' for The Dot Factory bitmap arrays, delaytime in milliseconds).
scrollbitmapy (0,lady_bits ,23,65, 'T', 30);

Posted in Uncategorized | Leave a comment