вот что получилось....
#include <MaxMatrix.h>
#include <avr/pgmspace.h>
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;PROGMEM const unsigned char CH[] = {
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // space 0
1, 8, B01011111, B00000000, B00000000, B00000000, B00000000, // ! 1
3, 8, B00000011, B00000000, B00000011, B00000000, B00000000, // " 2
5, 8, B00010100, B00111110, B00010100, B00111110, B00010100, // # 3
4, 8, B00100100, B01101010, B00101011, B00010010, B00000000, // $ 4
5, 8, B01100011, B00010011, B00001000, B01100100, B01100011, // % 5
5, 8, B00110110, B01001001, B01010110, B00100000, B01010000, // & 6
1, 8, B00000011, B00000000, B00000000, B00000000, B00000000, // ' 7
3, 8, B00011100, B00100010, B01000001, B00000000, B00000000, // ( 8
3, 8, B01000001, B00100010, B00011100, B00000000, B00000000, // ) 9
5, 8, B00101000, B00011000, B00001110, B00011000, B00101000, // * 10
5, 8, B00001000, B00001000, B00111110, B00001000, B00001000, // + 11
2, 8, B10110000, B01110000, B00000000, B00000000, B00000000, // , 12
4, 8, B00001000, B00001000, B00001000, B00001000, B00000000, // - 13
2, 8, B01100000, B01100000, B00000000, B00000000, B00000000, // . 14
4, 8, B01100000, B00011000, B00000110, B00000001, B00000000, // / 15
4, 8, B00111110, B01000001, B01000001, B00111110, B00000000, // 0 16
3, 8, B01000010, B01111111, B01000000, B00000000, B00000000, // 1 17
4, 8, B01100010, B01010001, B01001001, B01000110, B00000000, // 2 18
4, 8, B00100010, B01000001, B01001001, B00110110, B00000000, // 3 19
4, 8, B00011000, B00010100, B00010010, B01111111, B00000000, // 4 20
4, 8, B00100111, B01000101, B01000101, B00111001, B00000000, // 5 21
4, 8, B00111110, B01001001, B01001001, B00110000, B00000000, // 6 22
4, 8, B01100001, B00010001, B00001001, B00000111, B00000000, // 7 23
4, 8, B00110110, B01001001, B01001001, B00110110, B00000000, // 8 24
4, 8, B00000110, B01001001, B01001001, B00111110, B00000000, // 9 25
2, 8, B01010000, B00000000, B00000000, B00000000, B00000000, // : 26
2, 8, B10000000, B01010000, B00000000, B00000000, B00000000, // ; 27
3, 8, B00010000, B00101000, B01000100, B00000000, B00000000, // < 28
3, 8, B00010100, B00010100, B00010100, B00000000, B00000000, // = 29
3, 8, B01000100, B00101000, B00010000, B00000000, B00000000, // > 30
4, 8, B00000010, B01011001, B00001001, B00000110, B00000000, // ? 31
5, 8, B00111110, B01001001, B01010101, B01011101, B00001110, // @ 32
4, 8, B01111110, B00010001, B00010001, B01111110, B00000000, // A 33
4, 8, B01111111, B01001001, B01001001, B00110110, B00000000, // B 34
4, 8, B00111110, B01000001, B01000001, B00100010, B00000000, // C 35
4, 8, B01111111, B01000001, B01000001, B00111110, B00000000, // D 36
4, 8, B01111111, B01001001, B01001001, B01000001, B00000000, // E 37
4, 8, B01111111, B00001001, B00001001, B00000001, B00000000, // F 38
4, 8, B00111110, B01000001, B01001001, B01111010, B00000000, // G 39
4, 8, B01111111, B00001000, B00001000, B01111111, B00000000, // H 40
3, 8, B01000001, B01111111, B01000001, B00000000, B00000000, // I 41
4, 8, B00110000, B01000000, B01000001, B00111111, B00000000, // J 42
4, 8, B01111111, B00001000, B00010100, B01100011, B00000000, // K 43
4, 8, B01111111, B01000000, B01000000, B01000000, B00000000, // L 44
5, 8, B01111111, B00000010, B00001100, B00000010, B01111111, // M 45
5, 8, B01111111, B00000100, B00001000, B00010000, B01111111, // N 46
4, 8, B00111110, B01000001, B01000001, B00111110, B00000000, // O 47
4, 8, B01111111, B00001001, B00001001, B00000110, B00000000, // P 48
4, 8, B00111110, B01000001, B01000001, B10111110, B00000000, // Q 49
4, 8, B01111111, B00001001, B00001001, B01110110, B00000000, // R 50
4, 8, B01000110, B01001001, B01001001, B00110010, B00000000, // S 51
5, 8, B00000001, B00000001, B01111111, B00000001, B00000001, // T 52
4, 8, B00111111, B01000000, B01000000, B00111111, B00000000, // U 53
5, 8, B00001111, B00110000, B01000000, B00110000, B00001111, // V 54
5, 8, B00111111, B01000000, B00111000, B01000000, B00111111, // W 55
5, 8, B01100011, B00010100, B00001000, B00010100, B01100011, // X 56
5, 8, B00000111, B00001000, B01110000, B00001000, B00000111, // Y 57
4, 8, B01100001, B01010001, B01001001, B01000111, B00000000, // Z 58
2, 8, B01111111, B01000001, B00000000, B00000000, B00000000, // [ 59
4, 8, B00000001, B00000110, B00011000, B01100000, B00000000, // \ backslash 60
2, 8, B01000001, B01111111, B00000000, B00000000, B00000000, // ] 61
3, 8, B00000010, B00000001, B00000010, B00000000, B00000000, // hat 62
4, 8, B01000000, B01000000, B01000000, B01000000, B00000000, // _ 63
2, 8, B00000001, B00000010, B00000000, B00000000, B00000000, // ` 64
4, 8, B00100000, B01010100, B01010100, B01111000, B00000000, // a 65
4, 8, B01111111, B01000100, B01000100, B00111000, B00000000, // b 66
3, 8, B00111000, B01000100, B01000100, B00000000, B00000000, // c 67
4, 8, B00111000, B01000100, B01000100, B01111111, B00000000, // d 68
4, 8, B00111000, B01010100, B01010100, B00011000, B00000000, // e 69
3, 8, B00000100, B01111110, B00000101, B00000000, B00000000, // f 70
4, 8, B10011000, B10100100, B10100100, B01111000, B00000000, // g 71
4, 8, B01111111, B00000100, B00000100, B01111000, B00000000, // h 72
3, 8, B01000100, B01111101, B01000000, B00000000, B00000000, // i 73
4, 8, B01000000, B10000000, B10000100, B01111101, B00000000, // j 74
4, 8, B01111111, B00010000, B00101000, B01000100, B00000000, // k 75
3, 8, B01000001, B01111111, B01000000, B00000000, B00000000, // l 76
5, 8, B01111100, B00000100, B01111100, B00000100, B01111000, // m 77
4, 8, B01111100, B00000100, B00000100, B01111000, B00000000, // n 78
4, 8, B00111000, B01000100, B01000100, B00111000, B00000000, // o 79
4, 8, B11111100, B00100100, B00100100, B00011000, B00000000, // p 80
4, 8, B00011000, B00100100, B00100100, B11111100, B00000000, // q 81
4, 8, B01111100, B00001000, B00000100, B00000100, B00000000, // r 82
4, 8, B01001000, B01010100, B01010100, B00100100, B00000000, // s 83
3, 8, B00000100, B00111111, B01000100, B00000000, B00000000, // t 84
4, 8, B00111100, B01000000, B01000000, B01111100, B00000000, // u 85
5, 8, B00011100, B00100000, B01000000, B00100000, B00011100, // v 86
5, 8, B00111100, B01000000, B00111100, B01000000, B00111100, // w 87
5, 8, B01000100, B00101000, B00010000, B00101000, B01000100, // x 88
4, 8, B10011100, B10100000, B10100000, B01111100, B00000000, // y 89
3, 8, B01100100, B01010100, B01001100, B00000000, B00000000, // z 90
3, 8, B00001000, B00110110, B01000001, B00000000, B00000000, // { 91
1, 8, B01111111, B00000000, B00000000, B00000000, B00000000, // | 92
3, 8, B01000001, B00110110, B00001000, B00000000, B00000000, // } 93
4, 8, B00001000, B00000100, B00001000, B00000100, B00000000, // ~ 94
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // space 95
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 96
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 97
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 98
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 99
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 100
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 101
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 102
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 103
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 104
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 105
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 106
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 107
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 108
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 109
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 110
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 111
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 112
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 113
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 114
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 115
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 116
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 117
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 118
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 119
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 120
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 121
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 122
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 123
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 124
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 125
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 126
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 127
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 128
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 129
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 130
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 131
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 132
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 133
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 134
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 135
4, 8, B01111100, B01010101, B01010101, B01010100, B00000000, // Ё Ё 136
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 137
4, 8, B00111110, B01001001, B01001001, B00100010, B00000000, // Є Є 138
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 139
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 140
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 141
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 142
3, 8, B00000001, B11111110, B00000001, B00000000, B00000000, // ? Ї 143
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 144
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 145
1, 8, B01111111, B00000000, B00000000, B00000000, B00000000, // І І 146
1, 8, B01111010, B00000000, B00000000, B00000000, B00000000, // і і 147
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 148
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 149
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 150
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 151
4, 8, B00111000, B01010101, B01010101, B00001000, B00000000, // ё ё 152
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 153
4, 8, B00111000, B01010100, B01010100, B01010100, B00000000, // є є 154
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 155
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 156
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 157
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // ? 158
3, 8, B00000010, B01111000, B00000010, B00000000, B00000000, // ? ї 159
4, 8, B01111110, B00010001, B00010001, B01111110, B00000000, // A А 160
4, 8, B01111111, B01001001, B01001001, B00110001, B00000000, // Б Б 161
4, 8, B01111111, B01001001, B01001001, B00110110, B00000000, // B В 162
4, 8, B01111111, B00000001, B00000001, B00000001, B00000000, // Г Г 163
5, 8, B01100000, B00111111, B00100001, B00111111, B01100000, // Д Д 164
4, 8, B01111111, B01001001, B01001001, B01000001, B00000000, // E Е 165
5, 8, B01100011, B00010100, B01111111, B00010100, B01100011, // Ж Ж 166
4, 8, B01100011, B01000001, B01001001, B00110110, B00000000, // З З 167
5, 8, B01111111, B00100000, B00010000, B00001000, B01111111, // И И 168
5, 8, B01111111, B00100000, B00010011, B00001000, B01111111, // Й Й 169
4, 8, B01111111, B00001000, B00010100, B01100011, B00000000, // К К 170
4, 8, B01111110, B00000001, B00000001, B01111111, B00000000, // Л Л 171
5, 8, B01111111, B00000010, B00001100, B00000010, B01111111, // M М 172
4, 8, B01111111, B00001000, B00001000, B01111111, B00000000, // H Н 173
4, 8, B00111110, B01000001, B01000001, B00111110, B00000000, // O О 174
4, 8, B01111111, B00000001, B00000001, B01111111, B00000000, // П П 175
4, 8, B01111111, B00001001, B00001001, B00000110, B00000000, // P Р 176
4, 8, B00111110, B01000001, B01000001, B00100010, B00000000, // C С 177
5, 8, B00000001, B00000001, B01111111, B00000001, B00000001, // T Т 178
4, 8, B01000111, B01001000, B01001000, B00111111, B00000000, // У У 179
5, 8, B00001110, B00010001, B01111111, B00010001, B00001110, // Ф Ф 180
5, 8, B01100011, B00010100, B00001000, B00010100, B01100011, // X Х 181
5, 8, B01111111, B01000000, B01000000, B01111111, B11000000, // Ц Ц 182
4, 8, B00000111, B00001000, B00001000, B01111111, B00000000, // Ч Ч 183
5, 8, B01111111, B01000000, B01111111, B01000000, B01111111, // Ш Ш 184
6, 8, B01111111, B01000000, B01111111, B01000000, B11111111, // Щ Щ 185
5, 8, B00001001, B01111111, B01001000, B01001000, B00110000, // Ъ Ъ 186
5, 8, B01111111, B01001000, B01001000, B00110000, B01111111, // Ы Ы 187
4, 8, B01111111, B01001000, B01001000, B00110000, B00000000, // Ь Ь 188
4, 8, B01001001, B01001001, B01001001, B00111110, B00000000, // Э Э 189
5, 8, B01111111, B00001000, B00111110, B01000001, B00111110, // Ю Ю 190
4, 8, B01000110, B00101001, B00011001, B01111111, B00000000, // Я Я 191
4, 8, B00100000, B01010100, B01010100, B01111000, B00000000, // a а 192
4, 8, B00111100, B01001010, B01001010, B00110000, B00000000, // б б 193
4, 8, B01111100, B01010100, B01010100, B00101000, B00000000, // в в 194
4, 8, B01111110, B00000100, B00000100, B00000100, B00000000, // г г 195
5, 8, B11000000, B01111000, B01000100, B01111100, B11000000, // д д 196
4, 8, B00111000, B01010100, B01010100, B01001000, B00000000, // е е 197
5, 8, B01000100, B00101000, B01111100, B00101000, B01000100, // ж ж 198
4, 8, B00000000, B01000100, B01010100, B00101000, B00000000, // з з 199
4, 8, B01111100, B00010000, B00001000, B01111100, B00000000, // и и 200
4, 8, B01111100, B00010001, B00001001, B01111100, B00000000, // й й 201
4, 8, B01111100, B00010000, B00101000, B01000100, B00000000, // к к 202
4, 8, B01000000, B01111000, B00000100, B01111100, B00000000, // л л 203
5, 8, B01111100, B00001000, B00010000, B00001000, B01111100, // м м 204
4, 8, B01111100, B00010000, B00010000, B01111100, B00000000, // н н 205
4, 8, B00111000, B01000100, B01000100, B00111000, B00000000, // о о 206
4, 8, B01111100, B00000100, B00000100, B01111100, B00000000, // п п 207
4, 8, B01111100, B00010100, B00010100, B00001000, B00000000, // р р 208
3, 8, B00111000, B01000100, B01000100, B00000000, B00000000, // c с 209
5, 8, B00000100, B00000100, B01111100, B00000100, B00000100, // т т 210
4, 8, B01001100, B01010000, B01010000, B00111100, B00000000, // у у 211
5, 8, B00011000, B00100100, B01111100, B00100100, B00011000, // ф ф 212
5, 8, B01000100, B00101000, B00010000, B00101000, B01000100, // x х 213
5, 8, B01111100, B01000000, B01000000, B01111100, B11000000, // ц ц 214
4, 8, B00001100, B00010000, B00010000, B01111100, B00000000, // ч ч 215
5, 8, B01111100, B01000000, B01111100, B01000000, B01111100, // ш ш 216
5, 8, B01111100, B01000000, B01111100, B01000000, B11111100, // щ щ 217
5, 8, B00000100, B01111100, B01001000, B01001000, B00110000, // ъ ъ 218
5, 8, B01111100, B01010000, B00100000, B00000000, B01111100, // ы ы 219
4, 8, B01111100, B01010000, B01010000, B00100000, B00000000, // ь ь 220
4, 8, B01000100, B01010100, B01010100, B00111000, B00000000, // э э 221
5, 8, B01111100, B00010000, B00111000, B01000100, B00111000, // ю ю 222
4, 8, B01001000, B00110100, B00010100, B01111100, B00000000, // я я 223};
int data = 11; // DIN pin of MAX7219 module
int load = 10; // CS pin of MAX7219 module
int clock = 13; // CLK pin of MAX7219 moduleint maxInUse = 4; //change this variable to set how many MAX7219's you'll use
MaxMatrix m(data, load, clock, maxInUse); // define module
byte buffer[10];
void setup(){
m.init(); // module initialize
m.setIntensity(3); // dot matix intensity 0-15
Serial.begin(9600); // serial communication initialize
Wire.begin(); // RTC_DS1307
RTC.begin();
}void loop(){
DateTime now = RTC.now();
int TDay=now.day();
int TMonth=now.month();
int TYear=now.year();
int THour=now.hour();
int TMinutes=now.minute();
// this is the code if you want to entering a message via serial console
while (Serial.available() > 0){
byte c = Serial.read();
Serial.println(c, DEC);
printCharWithShift(c, 100);
}
delay(100);
m.shiftLeft(false, true);
char string1[] = "Besteugen";
sprintf(string1, " Дата %02d.%02d.%02d Год Время %02d.%02d ", TDay, TMonth, TYear, THour, TMinutes);
Serial.println(string1);
// print the active sentences
printStringWithShiftWIN1251(string1, 100);// printStringWithShift(string1, 100);
}void printCharWithShift(unsigned char c, int shift_speed){
if (c < 32) return;
c -= 32;
memcpy_P(buffer, CH + 7*c, 7);
m.writeSprite(32, 0, buffer);
m.setColumn(32 + buffer[0], 0);
// Serial.println(c, DEC);
for (int i=0; i<buffer[0]+1; i++)
{
delay(shift_speed);
m.shiftLeft(false, false);
}
}void printStringWithShift(char* s, int shift_speed){
while (*s != 0){
printCharWithShift(*s, shift_speed);
s++;
Serial.println(*s, DEC);
}
}void printString(char* s)
{
int col = 0;
while (*s != 0)
{
if (*s < 32) continue;
char c = *s - 32;
memcpy_P(buffer, CH + 7*c, 7);
m.writeSprite(col, 0, buffer);
m.setColumn(col + buffer[0], 0);
col += buffer[0] + 1;
s++;
Serial.println(c, DEC);
}
}void printStringWithShiftWIN1251(unsigned char* s, int shift_speed){
while (*s != 0){
if ((uint8_t)*s == 208 && *s+1 != 0) {
s++;
if (*s == 129) printCharWithShift(*s+39, shift_speed); //Ё
else printCharWithShift(*s+48, shift_speed);
s++;
} else if ((uint8_t)*s == 209 && *s+1 != 0) {
s++;
if (*s == 145) printCharWithShift(*s+39, shift_speed); //ё
if (*s > 127 && *s <= 143) printCharWithShift(*s+112, shift_speed);
s++;
} else {
printCharWithShift(*s, shift_speed);
s++;
}
}
}
Отредактировано besteugen (2017-10-13 00:58:02)