Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <MD_MAX72xx.h>
- #include <avr/pgmspace.h>
- const uint8_t PROGMEM font[] =
- {
- 0, // 0
- 0, // 1
- 0, // 2
- 0, // 3
- 0, // 4
- 0, // 5
- 0, // 6
- 0, // 7
- 0, // 8
- 0, // 9
- 0, // 10
- 0, // 11
- 0, // 12
- 0, // 13
- 0, // 14
- 0, // 15
- 5,0xff,0x00,0x00,0x00,0x00, // 16 - 'Bars'
- 5,0xff,0xff,0x00,0x00,0x00, // 17 - 'Bars'
- 5,0xff,0xff,0xff,0x00,0x00, // 18 - 'Bars'
- 5,0xff,0xff,0xff,0xff,0x00, // 19 - 'Bars'
- 5,0xff,0xff,0xff,0xff,0xff, // 20 - 'Bars'
- 5,0x00,0xff,0xff,0xff,0xff, // 21 - 'Bars'
- 5,0x00,0x00,0xff,0xff,0xff, // 22 - 'Bars'
- 5,0x00,0x00,0x00,0xff,0xff, // 23 - 'Bars'
- 5,0x00,0x00,0x00,0x00,0xff, // 24 - 'Bars'
- 5,0x60,0x70,0x3f,0x02,0x1c, // 25 - 'Musical Note'
- 5,0x03,0x33,0x48,0x48,0x48, // 26 - 'Deg C'
- 5,0x03,0x7b,0x28,0x28,0x08, // 27 - 'Deg F'
- 5,0x04,0x0c,0x1c,0x0c,0x04, // 28 - 'Down Pointer'
- 5,0x3e,0x1c,0x08,0x00,0x00, // 29 - 'Right Pointer'
- 5,0x08,0x1c,0x3e,0x00,0x00, // 30 - 'Left Pointer'
- 5,0x10,0x18,0x1c,0x18,0x10, // 31 - 'Up Pointer'
- 5,0x00,0x00,0x00,0x00,0x00, // 32 - 'Space'
- 5,0x5f,0x00,0x00,0x00,0x00, // 33 - '!'
- 5,0x07,0x00,0x07,0x00,0x00, // 34 - '"'
- 5,0x14,0x7f,0x14,0x7f,0x14, // 35 - '#'
- 5,0x24,0x2a,0x7f,0x2a,0x12, // 36 - '$'
- 5,0x23,0x13,0x08,0x64,0x62, // 37 - '%'
- 5,0x36,0x49,0x55,0x22,0x50, // 38 - '&'
- 5,0x00,0x05,0x03,0x00,0x00, // 39 - '''
- 5,0x1c,0x22,0x41,0x00,0x00, // 40 - '('
- 5,0x41,0x22,0x1c,0x00,0x00, // 41 - ')'
- 5,0x14,0x08,0x3e,0x08,0x14, // 42 - '*'
- 5,0x08,0x08,0x3e,0x08,0x08, // 43 - '+'
- 5,0xa0,0x60,0x00,0x00,0x00, // 44 - ','
- 5,0x08,0x08,0x08,0x08,0x08, // 45 - '-'
- 5,0x60,0x60,0x00,0x00,0x00, // 46 - '.'
- 5,0x20,0x10,0x08,0x04,0x02, // 47 - '/'
- 5,0x3e,0x51,0x49,0x45,0x3e, // 48 - '0'
- 5,0x42,0x7f,0x40,0x00,0x00, // 49 - '1'
- 5,0x42,0x61,0x51,0x49,0x46, // 50 - '2'
- 5,0x21,0x41,0x45,0x4b,0x31, // 51 - '3'
- 5,0x18,0x14,0x12,0x7f,0x10, // 52 - '4'
- 5,0x27,0x45,0x45,0x45,0x39, // 53 - '5'
- 5,0x3c,0x4a,0x49,0x49,0x30, // 54 - '6'
- 5,0x01,0x71,0x09,0x05,0x03, // 55 - '7'
- 5,0x36,0x49,0x49,0x49,0x36, // 56 - '8'
- 5,0x06,0x49,0x49,0x29,0x1e, // 57 - '9'
- 5,0x6c,0x6c,0x00,0x00,0x00, // 58 - ':'
- 5,0xac,0x6c,0x00,0x00,0x00, // 59 - ';'
- 5,0x08,0x14,0x22,0x41,0x00, // 60 - '<'
- 5,0x14,0x14,0x14,0x14,0x14, // 61 - '='
- 5,0x41,0x22,0x14,0x08,0x00, // 62 - '>'
- 5,0x02,0x01,0x51,0x09,0x06, // 63 - '?'
- 5,0x32,0x49,0x79,0x41,0x3e, // 64 - '@'
- 5,0x7e,0x11,0x11,0x11,0x7e, // 65 - 'A'
- 5,0x7f,0x49,0x49,0x49,0x36, // 66 - 'B'
- 5,0x3e,0x41,0x41,0x41,0x22, // 67 - 'C'
- 5,0x7f,0x41,0x41,0x22,0x1c, // 68 - 'D'
- 5,0x7f,0x49,0x49,0x49,0x41, // 69 - 'E'
- 5,0x7f,0x09,0x09,0x09,0x01, // 70 - 'F'
- 5,0x3e,0x41,0x49,0x49,0x7a, // 71 - 'G'
- 5,0x7f,0x08,0x08,0x08,0x7f, // 72 - 'H'
- 5,0x41,0x41,0x7f,0x41,0x41, // 73 - 'I'
- 5,0x20,0x40,0x41,0x3f,0x01, // 74 - 'J'
- 5,0x7f,0x08,0x14,0x22,0x41, // 75 - 'K'
- 5,0x7f,0x40,0x40,0x40,0x40, // 76 - 'L'
- 5,0x7f,0x02,0x0c,0x02,0x7f, // 77 - 'M'
- 5,0x7f,0x04,0x08,0x10,0x7f, // 78 - 'N'
- 5,0x3e,0x41,0x41,0x41,0x3e, // 79 - 'O'
- 5,0x7f,0x09,0x09,0x09,0x06, // 80 - 'P'
- 5,0x3e,0x41,0x51,0x21,0x5e, // 81 - 'Q'
- 5,0x7f,0x09,0x19,0x29,0x46, // 82 - 'R'
- 5,0x46,0x49,0x49,0x49,0x31, // 83 - 'S'
- 5,0x01,0x01,0x7f,0x01,0x01, // 84 - 'T'
- 5,0x3f,0x40,0x40,0x40,0x3f, // 85 - 'U'
- 5,0x1f,0x20,0x40,0x20,0x1f, // 86 - 'V'
- 5,0x3f,0x40,0x38,0x40,0x3f, // 87 - 'W'
- 5,0x63,0x14,0x08,0x14,0x63, // 88 - 'X'
- 5,0x07,0x08,0x70,0x08,0x07, // 89 - 'Y'
- 5,0x61,0x51,0x49,0x45,0x43, // 90 - 'Z'
- 5,0x7f,0x41,0x41,0x00,0x00, // 91 - '['
- 5,0x02,0x04,0x08,0x10,0x20, // 92 - '\'
- 5,0x41,0x41,0x7f,0x00,0x00, // 93 - ']'
- 5,0x04,0x02,0x01,0x02,0x04, // 94 - '^'
- 5,0x40,0x40,0x40,0x40,0x40, // 95 - '_'
- 5,0x01,0x02,0x04,0x00,0x00, // 96 - '`'
- 5,0x20,0x54,0x54,0x54,0x78, // 97 - 'a'
- 5,0x7f,0x50,0x48,0x48,0x30, // 98 - 'b'
- 5,0x38,0x44,0x44,0x44,0x20, // 99 - 'c'
- 5,0x30,0x48,0x48,0x50,0x7f, // 100 - 'd'
- 5,0x38,0x54,0x54,0x54,0x18, // 101 - 'e'
- 5,0x08,0x7e,0x09,0x01,0x02, // 102 - 'f'
- 5,0x18,0xa4,0xa4,0xa4,0x7c, // 103 - 'g'
- 5,0x7f,0x08,0x04,0x04,0x78, // 104 - 'h'
- 5,0x40,0x44,0x7d,0x40,0x40, // 105 - 'i'
- 5,0x40,0x80,0x88,0x7a,0x00, // 106 - 'j'
- 5,0x7f,0x10,0x28,0x44,0x00, // 107 - 'k'
- 5,0x41,0x7f,0x40,0x00,0x00, // 108 - 'l'
- 5,0x7c,0x04,0x18,0x04,0x78, // 109 - 'm'
- 5,0x7c,0x08,0x04,0x04,0x78, // 110 - 'n'
- 5,0x38,0x44,0x44,0x44,0x38, // 111 - 'o'
- 5,0xf8,0x28,0x24,0x24,0x18, // 112 - 'p'
- 5,0x18,0x24,0x24,0x28,0xf8, // 113 - 'q'
- 5,0x7c,0x08,0x04,0x04,0x08, // 114 - 'r'
- 5,0x48,0x54,0x54,0x54,0x20, // 115 - 's'
- 5,0x04,0x3f,0x44,0x40,0x20, // 116 - 't'
- 5,0x3c,0x40,0x40,0x20,0x7c, // 117 - 'u'
- 5,0x1c,0x20,0x40,0x20,0x1c, // 118 - 'v'
- 5,0x3c,0x40,0x30,0x40,0x3c, // 119 - 'w'
- 5,0x44,0x28,0x10,0x28,0x44, // 120 - 'x'
- 5,0x4c,0x90,0x90,0x90,0x7c, // 121 - 'y'
- 5,0x44,0x64,0x54,0x4c,0x44, // 122 - 'z'
- 5,0x08,0x36,0x41,0x00,0x00, // 123 - '{'
- 5,0x7f,0x00,0x00,0x00,0x00, // 124 - '|'
- 5,0x41,0x36,0x08,0x00,0x00, // 125 - '}'
- 5,0x08,0x08,0x2a,0x1c,0x08, // 126 - 'Right Arrow'
- 5,0x08,0x1c,0x2a,0x08,0x08, // 127 - 'Left Arrow'
- 0, // 128
- 0, // 129
- 0, // 130
- 0, // 131
- 0, // 132
- 0, // 133
- 0, // 134
- 0, // 135
- 0, // 136
- 0, // 137
- 0, // 138
- 0, // 139
- 0, // 140
- 0, // 141
- 0, // 142
- 0, // 143
- 0, // 144
- 5,0x1c,0x3e,0x3e,0x3e,0x1c, // 145 - 'Filled ball'
- 5,0x1c,0x22,0x22,0x22,0x1c, // 146 - 'Empty ball'
- 5,0x08,0x1c,0x3e,0x1c,0x08, // 147 - 'Filled diamond'
- 5,0x08,0x14,0x22,0x14,0x08, // 148 - 'Empty diamond'
- 5,0x77,0x00,0x00,0x00,0x00, // 149 - 'Pipe'
- 5,0x1c,0xa2,0x62,0x22,0x22, // 150 - 'C sedilla'
- 5,0x60,0x50,0x48,0x44,0x7e, // 151 - 'Triangle'
- 5,0x40,0x44,0x4a,0x51,0x40, // 152 - '<='
- 5,0x40,0x51,0x4a,0x44,0x40, // 153 - '>='
- 5,0x10,0x38,0x54,0x10,0x1f, // 154 - 'Return'
- 5,0x04,0x02,0x7f,0x02,0x04, // 155 - 'Up Arrow'
- 5,0x10,0x20,0x7f,0x20,0x10, // 156 - 'Down Arrow'
- 0, // 157
- 0, // 158
- 0, // 159
- 0, // 160
- 5,0x70,0x50,0x70,0x00,0x00, // 161
- 5,0x0f,0x01,0x01,0x00,0x00, // 162
- 5,0x40,0x40,0x78,0x00,0x00, // 163
- 5,0x10,0x20,0x40,0x00,0x00, // 164
- 5,0x60,0x60,0x00,0x00,0x00, // 165
- 5,0x0a,0x0a,0x4a,0x2a,0x1e, // 166
- 5,0x42,0x32,0x12,0x0a,0x06, // 167
- 5,0x20,0x10,0x08,0x7c,0x02, // 168
- 5,0x18,0x08,0x4c,0x48,0x38, // 169
- 5,0x48,0x48,0x78,0x48,0x48, // 170
- 5,0x48,0x28,0x18,0x7c,0x08, // 171
- 5,0x08,0x7c,0x08,0x28,0x18, // 172
- 5,0x40,0x48,0x48,0x78,0x40, // 173
- 5,0x54,0x54,0x54,0x54,0x7c, // 174
- 5,0x18,0x00,0x58,0x40,0x38, // 175
- 5,0x08,0x08,0x08,0x08,0x08, // 176
- 5,0x01,0x41,0x3d,0x09,0x07, // 177
- 5,0x10,0x08,0x7c,0x02,0x01, // 178
- 5,0x0e,0x02,0x43,0x22,0x1e, // 179
- 5,0x42,0x42,0x7e,0x42,0x42, // 180
- 5,0x22,0x12,0x0a,0x7f,0x02, // 181
- 5,0x42,0x3f,0x02,0x42,0x3e, // 182
- 5,0x0a,0x0a,0x7f,0x0a,0x0a, // 183
- 5,0x08,0x46,0x42,0x22,0x1e, // 184
- 5,0x04,0x03,0x42,0x3e,0x02, // 185
- 5,0x42,0x42,0x42,0x42,0x7e, // 186
- 5,0x02,0x4f,0x22,0x1f,0x02, // 187
- 5,0x4a,0x4a,0x40,0x20,0x1c, // 188
- 5,0x42,0x22,0x12,0x2a,0x46, // 189
- 5,0x02,0x3f,0x42,0x4a,0x46, // 190
- 5,0x06,0x48,0x40,0x20,0x1e, // 191
- 5,0x08,0x46,0x4a,0x32,0x1e, // 192
- 5,0x0a,0x4a,0x3e,0x09,0x08, // 193
- 5,0x0e,0x00,0x4e,0x20,0x1e, // 194
- 5,0x04,0x45,0x3d,0x05,0x04, // 195
- 5,0x7f,0x08,0x10,0x00,0x00, // 196
- 5,0x44,0x24,0x1f,0x04,0x04, // 197
- 5,0x20,0x22,0x22,0x22,0x20, // 198
- 5,0x42,0x2a,0x12,0x2a,0x06, // 199
- 5,0x22,0x12,0x7b,0x16,0x22, // 200
- 5,0x40,0x20,0x1f,0x00,0x00, // 201
- 5,0x78,0x00,0x02,0x04,0x78, // 202
- 5,0x3f,0x44,0x44,0x44,0x44, // 203
- 5,0x02,0x42,0x42,0x22,0x1e, // 204
- 5,0x04,0x02,0x04,0x08,0x30, // 205
- 5,0x32,0x02,0x7f,0x02,0x32, // 206
- 5,0x02,0x12,0x22,0x52,0x0e, // 207
- 5,0x2a,0x2a,0x2a,0x40,0x00, // 208
- 5,0x38,0x24,0x22,0x20,0x70, // 209
- 5,0x40,0x28,0x10,0x28,0x06, // 210
- 5,0x0a,0x3e,0x4a,0x4a,0x4a, // 211
- 5,0x04,0x7f,0x04,0x14,0x0c, // 212
- 5,0x40,0x42,0x42,0x7e,0x40, // 213
- 5,0x4a,0x4a,0x4a,0x4a,0x7e, // 214
- 5,0x04,0x05,0x45,0x25,0x1c, // 215
- 5,0x0f,0x40,0x20,0x1f,0x00, // 216
- 5,0x7c,0x00,0x7e,0x40,0x30, // 217
- 5,0x7e,0x40,0x20,0x10,0x08, // 218
- 5,0x7e,0x42,0x42,0x42,0x7e, // 219
- 5,0x0e,0x02,0x42,0x22,0x1e, // 220
- 5,0x42,0x42,0x40,0x20,0x18, // 221
- 5,0x04,0x08,0x02,0x04,0x00, // 222
- 5,0x0e,0x0a,0x0e,0x00,0x00, // 223
- 5,0x38,0x44,0x48,0x30,0x4c, // 224 - 'Alpha'
- 5,0x20,0x55,0x54,0x55,0x78, // 225 - 'a umlaut'
- 5,0xfc,0x2a,0x2a,0x2a,0x14, // 226 - 'Beta'
- 5,0x28,0x54,0x54,0x44,0x20, // 227 - 'Epsilon'
- 5,0xfc,0x20,0x20,0x10,0x3c, // 228 - 'mu'
- 5,0x38,0x44,0x4c,0x54,0x24, // 229 - 'sigma'
- 5,0xf0,0x28,0x24,0x24,0x18, // 230 - 'rho'
- 5,0x10,0xa8,0xa8,0xa8,0x78, // 231 - 'g'
- 5,0x20,0x40,0x3e,0x02,0x02, // 232 - 'square root'
- 5,0x04,0x04,0x00,0x0e,0x00, // 233
- 5,0x40,0x80,0x88,0x7a,0x00, // 234 - 'j'
- 5,0x05,0x02,0x05,0x00,0x00, // 235 - 'asterisk note'
- 5,0x18,0x24,0x7e,0x24,0x10, // 236 - 'cents'
- 5,0x14,0x7f,0x54,0x40,0x40, // 237 - 'pound sterling'
- 5,0x7c,0x09,0x05,0x05,0x78, // 238 - 'n accent'
- 5,0x38,0x45,0x44,0x45,0x38, // 239 - 'o umlaut'
- 5,0xfc,0x28,0x24,0x24,0x18, // 240 - 'p'
- 5,0x18,0x24,0x24,0x28,0xfc, // 241 - 'q'
- 5,0x3e,0x45,0x45,0x45,0x3e, // 242 - 'Theta'
- 5,0x30,0x28,0x10,0x28,0x18, // 243 - 'infinity'
- 5,0x58,0x64,0x04,0x64,0x58, // 244
- 5,0x3c,0x41,0x40,0x21,0x7c, // 245 - 'u umlaut'
- 5,0x63,0x55,0x49,0x41,0x41, // 246 - 'Sigma upper'
- 5,0x42,0x3e,0x02,0x7e,0x42, // 247 - 'Pi'
- 5,0x45,0x29,0x11,0x29,0x45, // 248 - 'x bar'
- 5,0x18,0xa0,0xa0,0xa0,0x78, // 249 - 'y'
- 5,0x14,0x14,0x7c,0x14,0x12, // 250
- 5,0x44,0x3c,0x14,0x14,0x74, // 251 - 'Exit (jap)'
- 5,0x7c,0x14,0x1c,0x14,0x7c, // 252 - 'Entrance (jap)'
- 5,0x08,0x08,0x2a,0x08,0x08, // 253 - 'divide'
- 0, // 254
- 5,0x7f,0x7f,0x7f,0x7f,0x7f, // 255 - '5x7 block'
- };
- MD_MAX72XX row1 = MD_MAX72XX(2, 4, 3, 12);
- MD_MAX72XX row2 = MD_MAX72XX(5, 7, 6, 12);
- char msg1[] = "TEST";
- char msg2[] = "This is a test";
- void setup() {
- row1.setFont(font);
- row2.setFont(font);
- row1.begin();
- row2.begin();
- row1.clear();
- row2.clear();
- }
- void loop(){
- runTimeRow1();
- runTimeRow2();
- delay(5000);
- row1.clear();
- row2.clear();
- }
- void runTimeRow1() {
- uint8_t data_1[5];
- int lines_1 = 0, j_1 = 95, k_1 = 0, lim_1 = 0;
- int i_1 = 0;
- for(i_1 = sizeof(msg1)-2; i_1 >= 0 ; i_1--){
- int alpha_1 = msg1[i_1]+0;
- row1.getChar(alpha_1, 5, data_1);
- if(alpha_1 == 32){
- lim_1 = 2-1;
- }else if(alpha_1 == 73 || alpha_1 == 105){
- lim_1 = 3-1;
- }else{
- lim_1 = 5-1;
- }
- for(k_1 = lim_1; k_1 > -1; k_1--){
- row1.setColumn(lines_1, data_1[k_1]);
- ++lines_1;
- }
- row1.setColumn(lines_1, 0x00);
- ++lines_1;
- }
- }
- void runTimeRow2() {
- uint8_t data_2[5];
- int lines_2 = 0, j_2 = 95, k_2 = 0, lim_2 = 0;
- int i_2 = 0;
- for(i_2 = sizeof(msg2)-2; i_2 >= 0 ; i_2--){
- int alpha_2 = msg2[i_2]+0;
- row1.getChar(alpha_2, 5, data_2);
- if(alpha_2 == 32){
- lim_2 = 2-1;
- }
- else{
- lim_2 = 5-1;
- }
- for(k_2 = lim_2; k_2 > -1; k_2--){
- row2.setColumn(lines_2, data_2[k_2]);
- ++lines_2;
- }
- row2.setColumn(lines_2, 0x00);
- ++lines_2;
- }
- }
Add Comment
Please, Sign In to add comment