for (byte c=0; c<8; ++c) {
for (byte y=0; y<8; ++y) {
byte data = (byte) pgm_read_byte (&myfont[disp[line][c]][y]); // fetch data from program memory
for (byte x=0; x<8; ++x) {
if (data & (1<<x)) {
// on is off
int color = 2;
if (line > 1)
color = 1;
set_pixel((7-x) + (line * 8),y + (c*8),color);
} else {
//set_pixel(x,y,1);
}
}
}
}
}
This is available code ,which i downloaded ,but i don't know how to use detail this syntax :
data = (byte) pgm_read_byte (&myfont[disp[line]
][y])[/color]
This code is so complex ,can you give me some codes simpler ,because i search on Google serveral days ,but difficult to found =( =(
Thanks
That's the wrong smiley to use when asking for FREE help.
Good luck with your project.
(edit: maybe you misunderstood my previous answer: what I meant is that I don't understand what you're trying to achieve; it wasn't a judgement about your project (which I don't know))
][y])
data = (get 8 pixels ) from (a font-character[pointed to by disp[currentline][current_character][current_character_pixel_line].
Which is a complicated way of Saying
if disp[line] = "A simple test"
then disp[line][0] = "A"
disp[line][1] = " "
disp[line][2] = "s"
... etc
then &myfont[] returns the address of a character inside a font array which holds the (8 x 8 pixels) character.
So &myfont[disp[line][0]] would return the address to the letter "A" in the font array.
&myfont[disp[line][0]][y] would return 8 pixels of row [y] of the letter "A"
This technique is used to convert a letter to pixels. e.g. (8x8 pixel font)
[font=Courier]
. . . . . . . .
. . . X . . . .
. . X . X . . .
. X . . . X . . => A
. X X X X X . .
X . . . . . X .
X . . . . . X .
. . . . . . . .
[/font]
It's reading 8 pixels as a byte.
Your code then loops through this code with [color=red]for (byte x=0; x<8; ++x)[/color]
And draws a pixel on the screen if it found a pixel in the font.
Thats about it.