#ARDUINO CODE AS FOLLOWS#Written by Andrew S. Parnellconst int numPatterns = 14;int anPins[8] = {18,17,16,15,14,2,3,4};int cathPins[8] = {5, 6, 7, 8, 9, 10, 11, 12};byte patterns[numPatterns][8][8] = {{ \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0} \},{ \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,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,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,1,1}, \{0,0,0,0,0,0,1,1}},{ \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,1,1,1}, \{0,0,0,0,0,1,1,1}, \{0,0,0,0,0,1,1,1}},{ \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,1,1,1,1}, \{0,0,0,0,1,1,1,1}, \{0,0,0,0,1,1,1,1}, \{0,0,0,0,1,1,1,1}},{ \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,1,1,1,1,1}, \{0,0,0,1,1,1,1,1}, \{0,0,0,1,1,1,1,1}, \{0,0,0,1,1,1,1,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\{1,0,0,0,0,0,0,0}, \{1,0,0,0,0,0,0,0}, \{1,0,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,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}, \{0,0,0,0,0,0,0,0}}};void setup() { for (int i = 0; i < 8; i++) { pinMode(anPins[i], OUTPUT); pinMode(cathPins[i], OUTPUT); } for (int i = 0; i < 8; i++) { digitalWrite(anPins[i], LOW); digitalWrite(cathPins[i], HIGH); }}void loop() { for(int i = 0; i < numPatterns; i++) { pattern(patterns[i], 500); }}void pattern(byte pat[8][8],unsigned long inc){ unsigned long T = millis() + inc; while(millis() < T) { for (int i = 0; i < 8; i++) { digitalWrite(cathPins[i], LOW); for (int j = 0; j < 8; j++) { digitalWrite(anPins[j], pat[i][j]); } blank(); digitalWrite(cathPins[i], HIGH); } }}void blank() { for (int i = 0; i < 8; i++) { digitalWrite(anPins[i], LOW); }}
Post a Comment
1 comment:
#ARDUINO CODE AS FOLLOWS
#Written by Andrew S. Parnell
const int numPatterns = 14;
int anPins[8] = {18,17,16,15,14,2,3,4};
int cathPins[8] = {5, 6, 7, 8, 9, 10, 11, 12};
byte patterns[numPatterns][8][8] = {{ \
{0,0,0,0,0,0,0,0}, \
{0,0,0,0,0,0,0,0}, \
{0,0,0,0,0,0,0,0}, \
{0,0,0,0,0,0,0,0}, \
{0,0,0,0,0,0,0,0}, \
{0,0,0,0,0,0,0,0}, \
{0,0,0,0,0,0,0,0}, \
{0,0,0,0,0,0,0,0} \
},{ \
{0,0,0,0,0,0,0,0}, \
{0,0,0,0,0,0,0,0}, \
{0,0,0,0,0,0,0,0}, \
{0,0,0,0,0,0,0,0}, \
{0,0,0,0,0,0,0,0}, \
{0,0,0,0,0,0,0,0}, \
{0,0,0,0,0,0,0,0}, \
{0,0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 8; i++) {
digitalWrite(anPins[i], LOW);
digitalWrite(cathPins[i], HIGH);
}
}
void loop() {
for(int i = 0; i < numPatterns; i++) {
pattern(patterns[i], 500);
}
}
void pattern(byte pat[8][8],unsigned long inc)
{
unsigned long T = millis() + inc;
while(millis() < T) {
for (int i = 0; i < 8; i++) {
digitalWrite(cathPins[i], LOW);
for (int j = 0; j < 8; j++) {
digitalWrite(anPins[j], pat[i][j]);
}
blank();
digitalWrite(cathPins[i], HIGH);
}
}
}
void blank() {
for (int i = 0; i < 8; i++) {
digitalWrite(anPins[i], LOW);
}
}
Post a Comment