17. November 2011
Pixelmonster Kleine Animation mit einem Pixelmonster. Leider war es nicht möglich die ganze Animation abzuspielen (wahrscheinlich wegen zu vielen Zeichen im Array) Linienlicht: Soundanzeige - wird mit einem normalen dreh-poti geregelt: Code "Pixelmonster":#define COL1 2 #define COL2 3 #define COL3 4 #define COL4 5 #define COL5 6 #define ROW1 7 #define ROW2 8 #define ROW3 9 #define ROW4 10 #define ROW5 11 #define ROW6 12 #define ROW7 13 int col[5] = {COL1,COL2,COL3,COL4,COL5}; int row[7] = {ROW1,ROW2,ROW3,ROW4,ROW5,ROW6,ROW7}; char anim[][7][5] = {{{0,0,0,0,0}, //0 {0,0,0,0,0}, {0,0,0,0,0}, {0,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,1,1,1,0}}, {{0,0,0,0,0}, //2 {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}, {1,0,0,0,1}}, {{0,0,0,0,0}, //3 {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,1,1,1,0}, {1,0,0,0,1}, {1,0,0,0,1}}, {{0,0,0,0,0}, //4 {0,0,0,0,0}, {0,0,0,0,0}, {0,1,1,1,0}, {1,0,0,0,1}, {1,1,0,1,1}, {1,0,0,0,1}}, {{0,0,0,0,0}, //5 {0,0,0,0,0}, {0,1,1,1,0}, {1,0,0,0,1}, {1,1,0,1,1}, {1,0,0,0,1}, {1,1,1,1,1}}, {{0,0,0,0,0}, //6 {0,1,1,1,0}, {1,0,0,0,1}, {1,1,0,1,1}, {1,0,0,0,1}, {1,1,1,1,1}, {0,1,0,1,0}}, {{0,1,1,1,0}, //7 first {1,0,0,0,1}, {1,1,0,1,1}, {1,0,0,0,1}, {1,1,1,1,1}, {0,1,0,1,0}, {0,1,0,1,0}}, {{0,1,1,1,0}, //8 {1,1,0,1,1}, {1,0,0,0,1}, {1,0,0,0,1}, {1,1,1,1,1}, {0,1,0,1,0}, {1,0,1,0,0}}, {{0,1,1,1,0}, //9 {1,0,0,0,1}, {1,1,0,1,1}, {1,0,0,0,1}, {1,1,1,1,1}, {0,1,0,1,0}, {0,1,0,1,0}}, {{0,1,1,1,0}, //10 {1,0,0,0,1}, {1,0,0,0,1}, {1,1,0,1,1}, {1,1,1,1,1}, {0,1,0,1,0}, {0,0,1,0,1}}, {{1,0,0,0,1}, //11 //second {1,1,0,1,1}, {1,0,0,0,1}, {1,1,1,1,1}, {0,1,0,1,0}, {0,1,0,1,0}, {0,0,0,0,0}}, {{1,0,0,0,1}, //12 {1,0,0,0,1}, {1,1,1,1,1}, {0,1,0,1,0}, {1,0,1,0,0}, {0,0,0,0,0}, {0,0,0,0,0}}, {{1,0,0,0,1}, //13 {1,1,1,1,1}, {0,1,0,1,0}, {0,1,0,1,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}}, {{1,1,1,1,1}, //14 {0,1,0,1,0}, {0,0,1,0,1}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}}, {{0,1,0,1,0}, //15 {0,1,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}}, {{1,0,1,0,0}, //16 {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}}, {{0,0,0,0,0}, //17 {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}}, {{0,0,0,0,0}, //18 {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}}, {{0,0,0,0,0}, //19 {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}, {0,0,0,0,0}}, {{0,0,0,0,0}, //20 {0,0,0,0,0}, {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}} }; /* ORIGINAL!! {{0,1,1,1,0}, {1,0,0,0,1}, {1,1,0,1,1}, {1,0,0,0,1}, {1,1,1,1,1}, {0,1,0,1,0}, {0,1,0,1,0}}, {{0,1,1,1,0}, {1,1,0,1,1}, {1,0,0,0,1}, {1,0,0,0,1}, {1,1,1,1,1}, {0,1,0,1,0}, {1,0,1,0,0}}, {{0,1,1,1,0}, {1,0,0,0,1}, {1,1,0,1,1}, {1,0,0,0,1}, {1,1,1,1,1}, {0,1,0,1,0}, {0,1,0,1,0}}, {{0,1,1,1,0}, {1,0,0,0,1}, {1,0,0,0,1}, {1,1,0,1,1}, {1,1,1,1,1}, {0,1,0,1,0}, {0,0,1,0,1}}}; */ int time=0; void setup(){ for(int i=2;i<=13;i++){ pinMode(i,OUTPUT); } for(int i=2;i<=6;i++){ digitalWrite(i, HIGH); } } void loop(){ for(int i=0;i<=20;i++){ for(time=0;time<=75;time++){ picFrame(anim[i]); } } } void picFrame(char pic[7][5]) { for(int y=0;y<=6;y++){ for(int x=0;x<=4;x++){ if(pic[y][x] == 1){ pulseLED(y,x); } } } } void pulseLED(byte y, byte x) { digitalWrite(col[x],LOW); digitalWrite(row[y],HIGH); delayMicroseconds(100); digitalWrite(col[x],HIGH); digitalWrite(row[y],LOW); }