1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
byte char_code[11][6] = {
{
B00111110,
B01000001,
B01000001,
B00111110,
B00000000,
B00000000
}, // 0 - if you look carefully
{B01000010, B01111111, B01000000, B00000000, B00000000, B00000000}, // 1
{B01100010, B01010001, B01001001, B01000110, B00000000, B00000000}, // 2
{B00100010, B01000001, B01001001, B00110110, B00000000, B00000000}, // 3
{B00011000, B00010100, B00010010, B01111111, B00000000, B00000000}, // 4
{B00100111, B01000101, B01000101, B00111001, B00000000, B00000000}, // 5
{B00111110, B01001001, B01001001, B00110000, B00000000, B00000000}, // 6
{B01100001, B00010001, B00001001, B00000111, B00000000, B00000000}, // 7
{B00110110, B01001001, B01001001, B00110110, B00000000, B00000000}, // 8
{B00000110, B01001001, B01001001, B00111110, B00000000, B00000000}, // 9
{B00010100, B00000000, B00000000, B00000000, B00000000, B00000000}, // :
};
void setString(char* input, int16_t column)
{
int16_t column_value = column;
while (*input != 0)
{
byte output = *input - 0x20;
for (int y=0; y<6; y++)
{
boolean send = true;
if (char_code[output][y]==B00000000)
if (char_code[output][y-1]==B00000000)
send = false;
if (send)
{
dotMatrix.setData(column_value,char_code[output][y]);
column_value++;
}
}
if (output==0x00)
for (int y=0; y<3; y++)
{
dotMatrix.setData(column_value,char_code[output][y]);
column_value++;
}
input++;
}
}
int stringSize(char* input)
{
int returnX = 0;
while (*input != 0)
{
byte output = *input - 0x20;
for (int y=0; y<6; y++)
{
boolean send = true;
if (char_code[output][y]==B00000000)
if (char_code[output][y-1]==B00000000)
send = false;
if (send)
returnX++;
}
if (output==0x00)
returnX = returnX+3;
input++;
}
return (returnX);
}
|