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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
| // Dot_matrix_ICONS.ino
#define Heart {{0, 1, 0, 0, 0, 1, 0, 0}, \
{1, 0, 1, 0, 1, 0, 1, 0}, \
{1, 0, 0, 1, 0, 0, 1, 0}, \
{0, 1, 0, 0, 0, 1, 0, 0}, \
{0, 0, 1, 0, 1, 0, 0, 0}, \
{0, 0, 0, 1, 0, 0, 0, 0}, \
{0, 0, 0, 0, 0, 0, 0, 0}, \
{0, 0, 0, 0, 0, 0, 0, 0} \
}
#define Arrow {{0, 0, 0, 0, 1, 0, 0, 0}, \
{0, 0, 0, 0, 0, 1, 0, 0}, \
{0, 0, 0, 0, 0, 0, 1, 0}, \
{1, 1, 1, 1, 1, 1, 1, 1}, \
{1, 1, 1, 1, 1, 1, 1, 1}, \
{0, 0, 0, 0, 0, 0, 1, 0}, \
{0, 0, 0, 0, 0, 1, 0, 0}, \
{0, 0, 0, 0, 1, 0, 0, 0} \
}
#define Anchor {{0, 0, 0, 1, 1, 0, 0, 0}, \
{0, 0, 1, 1, 1, 1, 0, 0}, \
{0, 0, 0, 1, 1, 0, 0, 0}, \
{0, 0, 0, 1, 1, 0, 0, 0}, \
{1, 0, 0, 1, 1, 0, 0, 1}, \
{1, 0, 0, 1, 1, 0, 0, 1}, \
{0, 1, 0, 1, 1, 0, 1, 0}, \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;
byte column = 0;
byte LEDs[8][8];
int col[8] = {6, 11, 10, 3, 17, 4, 8, 9};
int row[8] = {2, 7, 19, 5, 13, 18, 12, 16};
byte patterns[9][8][8] = { J, E, Space, T, Apos, A, I, M, E};
void setup()
{ for (int i = 2; i <= 19; i++) pinMode(i, OUTPUT);
for (int i = 1; i <= 8; i++) digitalWrite(col[i - 1], HIGH);
for (int i = 1; i <= 8; i++) digitalWrite(row[i - 1], HIGH);
}
//
void loop()
{
for (int decalage = 0; decalage < 8 * (9 - 1); decalage++)
{ clearArray();
setPattern(decalage);
unsigned long start = millis();
while ((millis() - start) <= interval)
{
updateDisplay();
delay(1);
}
}
}
//
void clearArray()
{ for (int i = 0; i < 8; i++)
{ for (int j = 0; j < 8; j++)LEDs[i][j] = 0;
}
}
//
void setPattern(int decalage)
{ for (int i = 0; i < 8; i++)
{ for (int j = 0; j < 8; j++)
{ int colIndex = (j + decalage) % 8;
int patternIndex = (decalage + j) / 8;
LEDs[i][j] = patterns[patternIndex][colIndex][i];
//LEDs[i][j] = patterns[colIndex][patternIndex][i];
}
}
}
//
void updateDisplay()
{
for (int i = 0; i < 8; i++)
{ digitalWrite(col[i], HIGH);
digitalWrite(row[i], LOW);
}
//
column++;
if (column == 8) column = 0;
for (int r = 0; r < 8; r++)
{
if (LEDs[column][r] == 1) digitalWrite(row[r], HIGH);
//if (LEDs[rangee][r] == 1) digitalWrite(row[r], HIGH);
else digitalWrite(row[r], LOW);
}
digitalWrite(col[column], LOW);
} |
Partager