Паяльник

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.


Вы здесь » Паяльник » Микроконтроллеры » Бегущая строка из N-Led матриц 8x8 на MAX7219 температура и влажность


Бегущая строка из N-Led матриц 8x8 на MAX7219 температура и влажность

Сообщений 91 страница 97 из 97

91

вот что получилось....

max7219_ds1307_RUS

#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 module

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

0

92

к часам добавил датчик температуры датчик давления изменил шрифт
получилось это...

max7219_bmp280_ds18b20_ds1307

#include <MaxMatrix.h>
#include <avr/pgmspace.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
#define BMP_CS 10
#include <Wire.h>
#include <DallasTemperature.h>              // Подключаем библиотеку DallasTempature
#define DS18B20 2
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;

PROGMEM const unsigned char CH[] = {
5, 8, 0x00,0x00,0x00,0x00,0x00, //space
3, 8, 0x00,0x00,0x5F,0x00,0x00, //!
3, 8, 0x00,0x02,0x04,0x02,0x04, //"
5, 8, 0x14,0x3E,0x14,0x3E,0x14, //#
5, 8, 0x22,0x45,0x7F,0x49,0x32, //$
5, 8, 0x23,0x13,0x08,0x64,0x62, //%
5, 8, 0x36,0x49,0x56,0x20,0x50, //&
1, 8, 0x00,0x00,0x07,0x07,0x00, //'
4, 8, 0x00,0x3C,0x42,0x81,0x00, //(
4, 8, 0x00,0x81,0x42,0x3C,0x00, //)
5, 8, 0x2A,0x1C,0x3E,0x1C,0x2A, //*
5, 8, 0x08,0x08,0x3E,0x08,0x08, //+
3, 8, 0x00,0x00,0xB0,0x70,0x00, //,
5, 8, 0x08,0x08,0x08,0x08,0x08, //-
3, 8, 0x00,0x60,0x60,0x00,0x00, //.
5, 8, 0x60,0x30,0x18,0x0C,0x06, ///
5, 8, 0x3E,0x41,0x41,0x41,0x3E, //0
4, 8, 0x00,0x42,0x7F,0x40,0x00, //1
5, 8, 0x42,0x61,0x51,0x49,0x46, //2
5, 8, 0x22,0x41,0x49,0x49,0x36, //3
5, 8, 0x18,0x14,0x12,0x11,0x7F, //4
5, 8, 0x27,0x45,0x45,0x45,0x39, //5
5, 8, 0x3E,0x49,0x49,0x49,0x32, //6
5, 8, 0x01,0x71,0x09,0x05,0x03, //7
5, 8, 0x36,0x49,0x49,0x49,0x36, //8
5, 8, 0x26,0x49,0x49,0x49,0x3E, //9
2, 8, 0x00,0x00,0x33,0x33,0x00, //:
2, 8, 0x00,0x00,0xB3,0x73,0x00, //;
5, 8, 0x08,0x14,0x22,0x41,0x00, //<
5, 8, 0x14,0x14,0x14,0x14,0x14, //=
5, 8, 0x00,0x41,0x22,0x14,0x08, //>
5, 8, 0x02,0x59,0x09,0x09,0x06, //?
5, 8, 0x3E,0x49,0x55,0x5D,0x0E, //@
5, 8, 0x7E,0x11,0x11,0x11,0x7E, //A
5, 8, 0x7F,0x49,0x49,0x49,0x36, //B
5, 8, 0x3E,0x41,0x41,0x41,0x22, //C
5, 8, 0x7F,0x41,0x41,0x41,0x3E, //D
5, 8, 0x7F,0x49,0x49,0x41,0x41, //E
5, 8, 0x7F,0x09,0x09,0x01,0x01, //F
5, 8, 0x3E,0x41,0x49,0x49,0x32, //G
5, 8, 0x7F,0x08,0x08,0x08,0x7F, //H
5, 8, 0x7F,0x40,0x40,0x40,0x40, //I
5, 8, 0x20,0x40,0x41,0x41,0x3F, //J
5, 8, 0x7F,0x08,0x14,0x22,0x41, //K
5, 8, 0x7F,0x40,0x40,0x40,0x40, //L
5, 8, 0x7F,0x02,0x0C,0x02,0x7F, //M
5, 8, 0x7F,0x08,0x10,0x20,0x7F, //N
5, 8, 0x3E,0x41,0x41,0x41,0x3E, //O
5, 8, 0x7F,0x09,0x09,0x09,0x06, //P
5, 8, 0x3E,0x41,0x51,0x21,0x5E, //Q
5, 8, 0x7F,0x09,0x19,0x29,0x46, //R
5, 8, 0x26,0x49,0x49,0x49,0x32, //S
5, 8, 0x01,0x01,0x7F,0x01,0x01, //T
5, 8, 0x3F,0x40,0x40,0x20,0x7F, //U
5, 8, 0x1F,0x20,0x40,0x20,0x1F, //V
5, 8, 0x3F,0x40,0x3E,0x40,0x3F, //W
5, 8, 0x63,0x14,0x08,0x14,0x63, //X
5, 8, 0x07,0x08,0x70,0x08,0x07, //Y
5, 8, 0x41,0x69,0x59,0x4D,0x4B, //Z
2, 8, 0x7F,0x41,0x00,0x00,0x00, // [
4, 8, 0x08,0x10,0x20,0x40,0x00, // \ backslash
2, 8, 0x41,0x7F,0x00,0x00,0x00, // ]
3, 8, 0x04,0x02,0x04,0x00,0x00, // hat
4, 8, 0x20,0x20,0x20,0x20,0x00, // _
4, 8, 0x06,0x09,0x09,0x06,0x00, //градус
5, 8, 0x20,0x54,0x54,0x34,0x78, //a
5, 8, 0x7F,0x28,0x48,0x48,0x30, //b
5, 8, 0x38,0x44,0x44,0x44,0x44, //c
5, 8, 0x30,0x48,0x48,0x50,0x7F, //d
5, 8, 0x38,0x54,0x54,0x54,0x18, //e
5, 8, 0x00,0x44,0x3E,0x05,0x00, //f
5, 8, 0x18,0xA4,0xA4,0x94,0x78, //g
5, 8, 0x7F,0x10,0x08,0x08,0x70, //h
4, 8, 0x00,0x48,0x7A,0x40,0x00, //i
5, 8, 0x00,0x40,0x80,0x84,0x7D, //j
4, 8, 0x7F,0x10,0x28,0x44,0x00, //k
4, 8, 0x00,0x41,0x7F,0x40,0x00, //l
5, 8, 0x78,0x04,0x78,0x04,0x78, //m
5, 8, 0x7C,0x08,0x04,0x04,0x78, //n
5, 8, 0x38,0x44,0x44,0x44,0x38, //o
5, 8, 0xF8,0x24,0x24,0x24,0x18, //p
5, 8, 0x18,0x24,0x24,0x24,0xF8, //q
5, 8, 0x7C,0x10,0x08,0x04,0x08, //r
5, 8, 0x48,0x54,0x54,0x54,0x24, //s
4, 8, 0x04,0x3F,0x44,0x40,0x20, //t
5, 8, 0x3C,0x40,0x40,0x20,0x7C, //u
5, 8, 0x1C,0x20,0x40,0x20,0x1C, //v
5, 8, 0x3C,0x40,0x38,0x40,0x3C, //w
5, 8, 0x44,0x28,0x10,0x28,0x44, //x
5, 8, 0x0C,0x50,0x50,0x50,0x3C, //y
4, 8, 0x44,0x64,0x54,0x4C,0x44, //z
5, 8, 0x08,0x36,0x41,0x41,0x00, //{
3, 8, 0x00,0x00,0x7F,0x00,0x00, //|
5, 8, 0x00,0x41,0x41,0x36,0x08, //]
4, 8, 0x10,0x08,0x10,0x08,0x00, // ~
3, 8, 0x00,0x00,0x00,0x00,0x00, // ?
5, 8, 0x7E,0x4B,0x4A,0x43,0x42, //Ё
3, 8, 0x00,0x00,0x00,0x00,0x00, // ?
4, 8, 0x3E,0x49,0x41,0x22,0x00, // Є
3, 8, 0x00,0x00,0x00,0x00,0x00, // ?
3, 8, 0x00,0x00,0x00,0x00,0x00, // ?
3, 8, 0x00,0x00,0x00,0x00,0x00, // ?
3, 8, 0x00,0x00,0x00,0x00,0x00, // ?
3, 8, 0x01,0x7C,0x01,0x00,0x00, // ? Ї
3, 8, 0x00,0x00,0x00,0x00,0x00, // ?
3, 8, 0x00,0x00,0x00,0x00,0x00, // ?
1, 8, 0x7F,0x00,0x00,0x00,0x00, // І І
1, 8, 0x7A,0x00,0x00,0x00,0x00, // і і
3, 8, 0x00,0x00,0x00,0x00,0x00, // ?
3, 8, 0x00,0x00,0x00,0x00,0x00, // ?
3, 8, 0x00,0x00,0x00,0x00,0x00, // ?
3, 8, 0x00,0x00,0x00,0x00,0x00, // ?
5, 8, 0x38,0x55,0x54,0x55,0x18, //ё
3, 8, 0x00,0x00,0x00,0x00,0x00, // ?
4, 8, 0x38,0x54,0x44,0x28,0x00, // є є
3, 8, 0x00,0x00,0x00,0x00,0x00, // ?
3, 8, 0x00,0x00,0x00,0x00,0x00, // ?
3, 8, 0x00,0x00,0x00,0x00,0x00, // ?
3, 8, 0x00,0x00,0x00,0x00,0x00, // ?
3, 8, 0x02,0x78,0x02,0x00,0x00, // ? ї
5, 8, 0x7C,0x12,0x11,0x11,0x7F, //А
5, 8, 0x7F,0x49,0x49,0x49,0x30, //Б
5, 8, 0x7F,0x49,0x49,0x49,0x36, //И
4, 8, 0x7F,0x01,0x01,0x01,0x01, //Г
5, 8, 0xC0,0x7E,0x41,0x7F,0xC0, //Д
5, 8, 0x7F,0x49,0x49,0x41,0x41, //Е
5, 8, 0x77,0x08,0x7F,0x08,0x77, //Ж
5, 8, 0x22,0x41,0x49,0x49,0x36, //З
5, 8, 0x7F,0x20,0x10,0x08,0x7F, //И
5, 8, 0x7F,0x20,0x11,0x08,0x7F, //Й
5, 8, 0x7F,0x08,0x14,0x22,0x41, //К
5, 8, 0x40,0x7C,0x02,0x01,0x7F, //Л
5, 8, 0x7F,0x02,0x0C,0x02,0x7F, //М
5, 8, 0x7F,0x08,0x08,0x08,0x7F, //Н
5, 8, 0x3E,0x41,0x41,0x41,0x3E, //О
5, 8, 0x7F,0x01,0x01,0x01,0x7F, //П
5, 8, 0x7F,0x09,0x09,0x09,0x06, //Р
5, 8, 0x3E,0x41,0x41,0x41,0x22, //С
5, 8, 0x01,0x01,0x7F,0x01,0x01, //Т
5, 8, 0x27,0x48,0x48,0x48,0x3F, //У
5, 8, 0x1C,0x22,0xFF,0x22,0x1C, //Ф
5, 8, 0x63,0x14,0x08,0x14,0x63, //Х
5, 8, 0x7F,0x40,0x40,0x7F,0xC0, //Ц
5, 8, 0x07,0x08,0x08,0x08,0x7F, //Ч
5, 8, 0x7F,0x40,0x7F,0x40,0x7F, //Ш
5, 8, 0x7F,0x40,0x7F,0x40,0xFF, //Щ
5, 8, 0x01,0x7F,0x48,0x48,0x30, //Ъ
5, 8, 0x7F,0x48,0x48,0x30,0x7F, //Ы
5, 8, 0x7F,0x48,0x48,0x48,0x30, //Ь
5, 8, 0x41,0x49,0x49,0x49,0x3E, //Э
5, 8, 0x7F,0x08,0x3E,0x41,0x3E, //Ю
5, 8, 0x46,0x29,0x19,0x09,0x7F, //Я
5, 8, 0x20,0x54,0x54,0x34,0x78, //а
5, 8, 0x7C,0x54,0x54,0x54,0x20, //б
5, 8, 0x7C,0x54,0x54,0x54,0x28, //в
4, 8, 0x7C,0x04,0x04,0x04,0x04, //г
5, 8, 0xC0,0x78,0x44,0x7C,0xC0, //д
5, 8, 0x38,0x54,0x54,0x54,0x18, //е
5, 8, 0x6C,0x10,0x7C,0x10,0x6C, //ж
5, 8, 0x28,0x44,0x54,0x54,0x28, //з
5, 8, 0x7C,0x20,0x10,0x08,0x7C, //и
5, 8, 0x7C,0x20,0x12,0x08,0x7C, //й
5, 8, 0x7C,0x10,0x10,0x28,0x44, //к
5, 8, 0x40,0x38,0x04,0x04,0x7C, //л
5, 8, 0x7C,0x08,0x10,0x08,0x7C, //м
5, 8, 0x7C,0x10,0x10,0x10,0x7C, //н
5, 8, 0x38,0x44,0x44,0x44,0x38, //о
5, 8, 0x7C,0x04,0x04,0x04,0x7C, //п
5, 8, 0x7C,0x14,0x14,0x14,0x08, //р
5, 8, 0x38,0x44,0x44,0x44,0x28, //с
5, 8, 0x04,0x04,0x7C,0x04,0x04, //т
5, 8, 0x0C,0x50,0x50,0x50,0x3C, //у
5, 8, 0x18,0x24,0xFE,0x24,0x18, //ф
5, 8, 0x44,0x28,0x10,0x28,0x44, //х
5, 8, 0x7C,0x40,0x40,0x7C,0xC0, //ц
5, 8, 0x0C,0x10,0x10,0x10,0x7C, //ч
5, 8, 0x7C,0x40,0x7C,0x40,0x7C, //ш
5, 8, 0x7C,0x40,0x7C,0x40,0xFC, //щ
5, 8, 0x04,0x7C,0x50,0x50,0x20, //ъ
5, 8, 0x7C,0x50,0x50,0x20,0x7C, //ы
5, 8, 0x7C,0x50,0x50,0x50,0x20, //ь
5, 8, 0x44,0x54,0x54,0x54,0x38, //э
5, 8, 0x7C,0x10,0x38,0x44,0x38, //ю
5, 8, 0x48,0x54,0x34,0x14,0x7C, //я

};

int data = 5;    // DIN pin of MAX7219 module
int load = 6 ;    // CS pin of MAX7219 module
int clock = 7;  // CLK pin of MAX7219 module

int 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];
OneWire oneWire(DS18B20);
DallasTemperature sensors(&oneWire);
Adafruit_BMP280 bmp(BMP_CS);

void setup(){
  m.init(); // module initialize
  m.setIntensity(2); // dot matix intensity 0-15
  Serial.begin(9600); // serial communication initialize
  Wire.begin();  // RTC_DS1307
  RTC.begin();
  bmp.begin();
  sensors.begin(); 
}

void loop(){
  int Temp1=bmp.readTemperature();
  int Pressure=bmp.readPressure()/133.322;
  sensors.requestTemperatures();
  int Temp=(sensors.getTempCByIndex(0));
   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, "Дaтa %02d.%02d.%02d г Вpeмя %02d.%02d Дaвлeниe %02d мм квapтиpa %02d`C улицa %02d`C ", TDay, TMonth, TYear, THour, TMinutes, Pressure, Temp1, Temp);
  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;
if ((c>95) && (c<136)) return;
if (c>135) c-=40;
  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++;
    }
  }
}

http://s7.uploads.ru/t/AUsTS.jpg

Отредактировано besteugen (2017-10-18 18:49:53)

0

93

Дайте пожалуйста ссылку на вашу библиотеку для bmp280

0

94

Как еще можно перевернуть изображение матрицы ?

0

95

Про поворот было в посте #25
(для ленивых "http://arduino.ru/forum/programmirovanie/led-matritsa-max7219-maxmatrixlib" пост #40)

...

библиотека Adafruit-GFX (поменять файл glcdfont.c для русских букв), Max72xxPanel, ARDUINO 1.6.4

int pinCS = 10; //   DIN 11   CLK 13
int numberOfHorizontalDisplays = 1
int numberOfVerticalDisplays = 4

<setup>
matrix.setRotation(matrix.getRotation()+1); //1 - 90  2 - 180   3 - 270 град

Пробуем отписываемся.

Либо

matrix.setRotation(0, 1);   
matrix.setRotation(1, 1);   
matrix.setRotation(2, 1);   
matrix.setRotation(3, 1);

Аналогично.

Проверить не на чем все дисплеи уже ушли.

скетч

Код:
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Max72xxPanel.h>

int pinCS = 10; // Attach CS to this pin, DIN to MOSI and CLK to SCK (cf <a href="<a href="<a href="http://arduino.cc/en/Reference/SPI" rel="nofollow">http://arduino.cc/en/Reference/SPI</a>" rel="nofollow"><a href="http://arduino.cc/en/Reference/SPI" rel="nofollow">http://arduino.cc/en/Reference/SPI</a></a>" title="<a href="<a href="http://arduino.cc/en/Reference/SPI" rel="nofollow">http://arduino.cc/en/Reference/SPI</a>" rel="nofollow"><a href="http://arduino.cc/en/Reference/SPI" rel="nofollow">http://arduino.cc/en/Reference/SPI</a></a>" rel="nofollow"><a href="<a href="http://arduino.cc/en/Reference/SPI" rel="nofollow">http://arduino.cc/en/Reference/SPI</a>" rel="nofollow"><a href="http://arduino.cc/en/Reference/SPI" rel="nofollow">http://arduino.cc/en/Reference/SPI</a></a></a> )
// Uno or Duemilanove DIN 11 (MOSI) CLK 13 (SCK)
int numberOfHorizontalDisplays = 1;
int numberOfVerticalDisplays = 5;

Max72xxPanel matrix = Max72xxPanel(pinCS, numberOfHorizontalDisplays, numberOfVerticalDisplays);

String tape = "";
int wait = 100; // In milliseconds

int spacer = 1;
int width = 5 + spacer; // The font width is 5 pixels

void setup() {
  tape = utf8rus("Пробуем и отписываемся.");
  matrix.setIntensity(3); // Use a value between 0 and 15 for brightness
  matrix.setRotation(matrix.getRotation()+3); //1 - 90  2 - 180   3 - 270

}
void loop() {
  for ( int i = 0 ; i < width * tape.length() + matrix.width() - 1 - spacer; i++ ) 
       {
    matrix.fillScreen(LOW);

    int letter = i / width;
    int x = (matrix.width() - 1) - i % width;
    int y = (matrix.height() - 8) / 2; // center the text vertically

    while ( x + width - spacer >= 0 && letter >= 0 ) {
      if ( letter < tape.length() ) {
        matrix.drawChar(x, y, tape[letter], HIGH, LOW,1);
      }
      letter--;
      x -= width;
    }
    matrix.write(); // Send bitmap to display
    delay(wait);
  }
}

Отредактировано Technik (2017-12-05 22:12:45)

0

96

День добрый. Ребята, подскажите в чем проблема. на днях пришла матрица 7219. проверил работает. совместил 2 почемуто работает только одна. я так понял что то в скетче поменять надо. короче заменил в третей строке 4 на 8 - опять такая же фигня. ткните пальцем где не так. начинающий ардуинщик.

Код:
#include <avr/pgmspace.h>
#include <LedControl.h>
 
 
const int numDevices = 8; // number of MAX7219s used
const long scrollDelay = 20; // adjust scrolling speed
 
 
unsigned long bufferLong [14] = {0};
 
 
LedControl lc=LedControl(11,13,10,numDevices);//din,clk,cs
 
 
const unsigned char scrollText[] PROGMEM ={" LJ,HJ GJ;FKJDFNM    CTUJLYZ D GHJLF;T:   JLTZKF  GJLEIRB  VFNHFCS  GKTLS  [FKFNS    "};
 
 
void setup(){ 
for (int x=0; x<numDevices; x++){
lc.shutdown(x,false); //The MAX72XX is in power-saving mode on startup
lc.setIntensity(x,8); // Set the brightness to default value
lc.clearDisplay(x); // and clear the display
}
}
 
 
void loop(){
scrollMessage(scrollText);
// scrollFont();
}
 
 
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
 
const unsigned char font5x7 [] PROGMEM = { //Numeric Font Matrix (Arranged as 7x font data + 1x kerning data)
B00000000, //Space (Char 0x20)
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
6,
 
 
B10000000, //!
B10000000,
B10000000,
B10000000,
B00000000,
B00000000,
B10000000,
2,
 
 
B10100000, //"
B10100000,
B10100000,
B00000000,
B00000000,
B00000000,
B00000000,
4,
 
 
B01010000, //#
B01010000,
B11111000,
B01010000,
B11111000,
B01010000,
B01010000,
6,
 
 
B00100000, //$
B01111000,
B10100000,
B01110000,
B00101000,
B11110000,
B00100000,
6,
 
 
B11000000, //%
B11001000,
B00010000,
B00100000,
B01000000,
B10011000,
B00011000,
6,
 
 
B01100000, //&
B10010000,
B10100000,
B01000000,
B10101000,
B10010000,
B01101000,
6,
 
 
B11000000, //'
B01000000,
B10000000,
B00000000,
B00000000,
B00000000,
B00000000,
3,
 
 
B00100000, //(
B01000000,
B10000000,
B10000000,
B10000000,
B01000000,
B00100000,
4,
 
 
B10000000, //)
B01000000,
B00100000,
B00100000,
B00100000,
B01000000,
B10000000,
4,
 
 
B00000000, //*
B00100000,
B10101000,
B01110000,
B10101000,
B00100000,
B00000000,
6,
 
 
B00000000, //+
B00100000,
B00100000,
B11111000,
B00100000,
B00100000,
B00000000,
6,
 
 
B11111000, //,
B10000000,
B10000000,
B11110000,
B10001000,
B10001000,
B11110000,
6,
 
 
B00000000, //-
B00000000,
B00000000,
B11111000,
B00000000,
B00000000,
B00000000,
6,
 
 
B00000000, //.
B00000000,
B00000000,
B00000000,
B00000000,
B11000000,
B11000000,
3,
 
 
B00000000, ///
B00001000,
B00010000,
B00100000,
B01000000,
B10000000,
B00000000,
6,
 
 
B01110000, //0
B10001000,
B10011000,
B10101000,
B11001000,
B10001000,
B01110000,
6,
 
 
B01000000, //1
B11000000,
B01000000,
B01000000,
B01000000,
B01000000,
B11100000,
4,
 
 
B01110000, //2
B10001000,
B00001000,
B00010000,
B00100000,
B01000000,
B11111000,
6,
 
 
B11111000, //3
B00010000,
B00100000,
B00010000,
B00001000,
B10001000,
B01110000,
6,
 
 
B00010000, //4
B00110000,
B01010000,
B10010000,
B11111000,
B00010000,
B00010000,
6,
 
 
B11111000, //5
B10000000,
B11110000,
B00001000,
B00001000,
B10001000,
B01110000,
6,
 
 
B00110000, //6
B01000000,
B10000000,
B11110000,
B10001000,
B10001000,
B01110000,
6,
 
 
B11111000, //7
B10001000,
B00001000,
B00010000,
B00100000,
B00100000,
B00100000,
6,
 
 
B01110000, //8
B10001000,
B10001000,
B01110000,
B10001000,
B10001000,
B01110000,
6,
 
 
B01110000, //9
B10001000,
B10001000,
B01111000,
B00001000,
B00010000,
B01100000,
6,
 
 
B00000000, //:
B11000000,
B11000000,
B00000000,
B11000000,
B11000000,
B00000000,
3,
 
 
B10010010, //;/Ж
B01010100,
B00111000,
B00010000,
B00111000,
B01010100,
B10010010,
8,
 
 
B00010000, //<
B00100000,
B01000000,
B10000000,
B01000000,
B00100000,
B00010000,
5,
 
 
B00000000, //=
B00000000,
B11111000,
B00000000,
B11111000,
B00000000,
B00000000,
6,
 
 
B10000000, //>
B01000000,
B00100000,
B00010000,
B00100000,
B01000000,
B10000000,
5,
 
 
B01110000, //?
B10001000,
B00001000,
B00010000,
B00100000,
B00000000,
B00100000,
6,
 
 
B01110000, //@
B10001000,
B00001000,
B01101000,
B10101000,
B10101000,
B01110000,
6,
 
 
B01110000, //A
B10001000,
B10001000,
B10001000,
B11111000,
B10001000,
B10001000,
6,
 
 
B10001000, //B(И)
B10001000,
B10011000,
B10101000,
B11001000,
B10001000,
B10001000,
6,
 
 
B01110000, //C
B10001000,
B10000000,
B10000000,
B10000000,
B10001000,
B01110000,
6,
 
 
B11110000, //D(В)
B10001000,
B10001000,
B11110000,
B10001000,
B10001000,
B11110000,
6,
 
 
B10001000, //E(У)
B10001000,
B10001000,
B01111000,
B00001000,
B10001000,
B01110000,
6,
 
 
B01110000, //F(А)
B10001000,
B10001000,
B10001000,
B11111000,
B10001000,
B10001000,
6,
 
 
B11111000, //G(П)
B10001000,
B10001000,
B10001000,
B10001000,
B10001000,
B10001000,
6,
 
 
B11110000, //H(Р)
B10001000,
B10001000,
B11110000,
B10000000,
B10000000,
B10000000,
6,
 
 
B10101000, //I(Ш)
B10101000,
B10101000,
B10101000,
B10101000,
B10101000,
B11111000,
6,
 
 
B01110000, //J(О)
B10001000,
B10001000,
B10001000,
B10001000,
B10001000,
B01110000,
6,
 
 
B00111000, //K(Л)
B01001000,
B01001000,
B01001000,
B01001000,
B01001000,
B10001000,
6,
 
 
B00111100, //Д/L
B01000100,
B01000100,
B01000100,
B01000100,
B11111110,
B10000010,
8,
 
 
B10000000, //M/Ь
B10000000,
B10000000,
B11110000,
B10001000,
B10001000,
B11110000,
6,
 
 
B11111000, //N(Т)
B00100000,
B00100000,
B00100000,
B00100000,
B00100000,
B00100000,
6,
 
 
B01110000, //O
B10001000,
B10001000,
B10001000,
B10001000,
B10001000,
B01110000,
6,
 
 
B01110000, //P/З
B10001000,
B00001000,
B01110000,
B00001000,
B10001000,
B01110000,
6,
 
 
B01110000, //Q(Й)
B10001000,
B10011000,
B10101000,
B11001000,
B10001000,
B10001000,
6,
 
 
B10001000, //R(К)
B10010000,
B10100000,
B11000000,
B10100000,
B10010000,
B10001000,
6,
 
 
B10000100, //Ы/S
B10000100,
B10000100,
B11100100,
B10010100,
B10010100,
B11100100,
7,
 
 
B11111000, //T(Е)
B10000000,
B10000000,
B11110000,
B10000000,
B10000000,
B11111000,
6,
 
 
B11111000, //U(Г)
B10001000,
B10000000,
B10000000,
B10000000,
B10000000,
B10000000,
6,
 
 
B10001000, //V(М)
B11011000,
B10101000,
B10001000,
B10001000,
B10001000,
B10001000,
6,
 
 
B10001000, //W
B10001000,
B10001000,
B10101000,
B10101000,
B10101000,
B01010000,
6,
 
 
B10001000, //X
B10001000,
B01010000,
B00100000,
B01010000,
B10001000,
B10001000,
6,
 
 
B10001000, //Y(Н)
B10001000,
B10001000,
B11111000,
B10001000,
B10001000,
B10001000,
6,
 
 
B01111000, //Z(Я)
B10001000,
B10001000,
B01111000,
B00101000,
B01001000,
B10001000,
6,
 
 
B10001000, //[(х)
B10001000,
B01010000,
B00100000,
B01010000,
B10001000,
B10001000,
6,
 
 
B00000000, //(Backward Slash)
B10000000,
B01000000,
B00100000,
B00010000,
B00001000,
B00000000,
6,
 
 
B11100000, //]
B00100000,
B00100000,
B00100000,
B00100000,
B00100000,
B11100000,
4,
 
 
B00100000, //^
B01010000,
B10001000,
B00000000,
B00000000,
B00000000,
B00000000,
6,
 
 
B00000000, //_
B00000000,
B00000000,
B00000000,
B00000000,
B00000000,
B11111000,
6,
 
 
B10000000, //`
B01000000,
B00100000,
B00000000,
B00000000,
B00000000,
B00000000,
4,
 
 
B00000000, //a
B00000000,
B01110000,
B00001000,
B01111000,
B10001000,
B01111000,
6,
 
 
B00000000, //b(и)
B00000000,
B10001000,
B10011000,
B10101000,
B11001000,
B10001000,
6,
 
 
B00000000, //c
B00000000,
B01110000,
B10001000,
B10000000,
B10001000,
B01110000,
6,
 
 
B00001000, //d
B00001000,
B01101000,
B10011000,
B10001000,
B10001000,
B01111000,
6,
 
 
B00000000, //e(у)
B00000000,
B10001000,
B10001000,
B11111000,
B00001000,
B01110000,
6,
 
 
B00000000, //f(а)
B00000000,
B01110000,
B00001000,
B01111000,
B10001000,
B01111000,
6,
 
 
B00000000, //g(п)
B00000000,
B11110000,
B10001000,
B10001000,
B10001000,
B10001000,
6,
 
 
B10000000, //h
B10000000,
B10110000,
B11001000,
B10001000,
B10001000,
B10001000,
6,
 
 
B01000000, //i
B00000000,
B11000000,
B01000000,
B01000000,
B01000000,
B11100000,
4,
 
 
B00000000, //j(о)
B00000000,
B01110000,
B10001000,
B10001000,
B10001000,
B01110000,
6,
 
 
B00000000, //k(л)
B00000000,
B00111000,
B01001000,
B01001000,
B01001000,
B10001000,
6,
 
 
B11000000, //l
B01000000,
B01000000,
B01000000,
B01000000,
B01000000,
B11100000,
4,
 
 
B00000000, //m
B00000000,
B11010000,
B10101000,
B10101000,
B10001000,
B10001000,
6,
 
 
B00000000, //n(т)
B00000000,
B11111000,
B00100000,
B00100000,
B00100000,
B00100000,
6,
 
 
B00000000, //o
B00000000,
B01110000,
B10001000,
B10001000,
B10001000,
B01110000,
6,
 
 
B00000000, //p
B00000000,
B11110000,
B10001000,
B11110000,
B10000000,
B10000000,
6,
 
 
B00000000, //q(й)
B01110000,
B10001000,
B10011000,
B10101000,
B11001000,
B10001000,
6,
 
 
B00000000, //r
B00000000,
B10110000,
B11001000,
B10000000,
B10000000,
B10000000,
6,
 
 
B00000000, //s
B00000000,
B01110000,
B10000000,
B01110000,
B00001000,
B11110000,
6,
 
 
B01000000, //t
B01000000,
B11100000,
B01000000,
B01000000,
B01001000,
B00110000,
6,
 
 
B00000000, //u
B00000000,
B10001000,
B10001000,
B10001000,
B10011000,
B01101000,
6,
 
 
B00000000, //v
B00000000,
B10001000,
B10001000,
B10001000,
B01010000,
B00100000,
6,
 
 
B00000000, //w
B00000000,
B10001000,
B10101000,
B10101000,
B10101000,
B01010000,
6,
 
 
B00000000, //x
B00000000,
B10001000,
B01010000,
B00100000,
B01010000,
B10001000,
6,
 
 
B00000000, //y(н)
B00000000,
B10001000,
B10001000,
B11111000,
B10001000,
B10001000,
6,
 
 
B00000000, //z
B00000000,
B11111000,
B00010000,
B00100000,
B01000000,
B11111000,
6,
 
 
B10001000, //{(Х)
B10001000,
B01010000,
B00100000,
B01010000,
B10001000,
B10001000,
6,
 
 
B10000000, //|
B10000000,
B10000000,
B10000000,
B10000000,
B10000000,
B10000000,
2,
 
 
B10000000, //}
B01000000,
B01000000,
B00100000,
B01000000,
B01000000,
B10000000,
4,
 
 
B00000000, //~
B00000000,
B00000000,
B01101000,
B10010000,
B00000000,
B00000000,
6,
 
 
B01100000, // (Char 0x7F)
B10010000,
B10010000,
B01100000,
B00000000,
B00000000,
B00000000,
5
 
};
 
 
void scrollFont() {
for (int counter=0x20;counter<0x80;counter++){
loadBufferLong(counter);
delay(500);
}
}
 
 
// Scroll Message
void scrollMessage(const unsigned char * messageString) {
int counter = 0;
int myChar=0;
do {
// read back a char
myChar = pgm_read_byte_near(messageString + counter);
if (myChar != 0){
loadBufferLong(myChar);
}
counter++;
}
while (myChar != 0);
}
// Load character into scroll buffer
void loadBufferLong(int ascii){
if (ascii >= 0x20 && ascii <=0xff){
for (int a=0;a<7;a++){ // Loop 7 times for a 5x7 font
unsigned long c = pgm_read_byte_near(font5x7 + ((ascii - 0x20) * 8) + a); // Index into character table to get row data
unsigned long x = bufferLong [a*2]; // Load current scroll buffer
x = x | c; // OR the new character onto end of current
bufferLong [a*2] = x; // Store in buffer
}
byte count = pgm_read_byte_near(font5x7 +((ascii - 0x20) * 8) + 7); // Index into character table for kerning data
for (byte x=0; x<count;x++){
rotateBufferLong();
printBufferLong();
delay(scrollDelay);
}
}
}
// Rotate the buffer
void rotateBufferLong(){
for (int a=0;a<7;a++){ // Loop 7 times for a 5x7 font
unsigned long x = bufferLong [a*2]; // Get low buffer entry
byte b = bitRead(x,31); // Copy high order bit that gets lost in rotation
x = x<<1; // Rotate left one bit
bufferLong [a*2] = x; // Store new low buffer
x = bufferLong [a*2+1]; // Get high buffer entry
x = x<<1; // Rotate left one bit
bitWrite(x,0,b); // Store saved bit
bufferLong [a*2+1] = x; // Store new high buffer
}
}
// Display Buffer on LED matrix
void printBufferLong(){
for (int a=0;a<7;a++){ // Loop 7 times for a 5x7 font
unsigned long x = bufferLong [a*2+1]; // Get high buffer entry
byte y = x; // Mask off first character
lc.setRow(3,a,y); // Send row to relevent MAX7219 chip
x = bufferLong [a*2]; // Get low buffer entry
y = (x>>24); // Mask off second character
lc.setRow(2,a,y); // Send row to relevent MAX7219 chip
y = (x>>16); // Mask off third character
lc.setRow(1,a,y); // Send row to relevent MAX7219 chip
y = (x>>8); // Mask off forth character
lc.setRow(0,a,y); // Send row to relevent MAX7219 chip
}
}

Отредактировано Юрий (2017-12-12 09:13:58)

0

97

Для 2х матриц
const int numDevices = 2; // number of MAX7219s used

0


Вы здесь » Паяльник » Микроконтроллеры » Бегущая строка из N-Led матриц 8x8 на MAX7219 температура и влажность


создать форум