Willkommen auf unserem Seminar-Blog

Immer auf dem aktuellen Stand bleiben

Dieser Seminar-Blog befindet sich noch im Aufbau und wird in den kommenden Tagen entsprechend verfeinert.

Member Login

Lost your password?

Registration is closed

Sorry, you are not allowed to register by yourself on this site!

You must either be invited by one of our team member or request an invitation by email at viad.info {at} zhdk {dot} ch.

09 Dot-Matrix

14. November 2011

YouTube Preview Image
#define colum1 8
#define colum2 12
#define colum3 10
#define colum4 9
#define colum5 11
//
#define row1 6
#define row2 5
#define row3 7
#define row4 3
#define row5 4
#define row6 2
#define row7 1

int colum[5] ={colum1,colum2,colum3,colum4,colum5};
int row[7]={row1,row2,row3,row4,row5,row6,row7};
//
int herzchen[7][5]={
{0,1,1,0,0},
{1,0,0,1,0},
{1,0,0,1,0},
{0,1,0,0,1},
{1,0,0,1,0},
{1,0,0,1,0},
{0,1,1,0,0}
};
int mal[7][5]={
{0,0,0,0,0},
{0,0,0,0,0},
{0,1,0,1,0},
{0,0,1,0,0},
{0,1,0,1,0},
{0,0,0,0,0},
{0,0,0,0,0}
};
int fisch[7][5]={
{0,0,1,0,0},
{0,1,0,1,0},
{1,0,0,1,0},
{1,0,0,0,1},
{0,1,0,1,0},
{0,0,1,0,0},
{0,1,0,1,0}
};
int gleich[7][5]={
{0,0,0,0,0},
{0,0,0,0,0},
{0,1,0,1,0},
{0,1,0,1,0},
{0,1,0,1,0},
{0,0,0,0,0},
{0,0,0,0,0},
};
int monster[7][5]={
{0,1,0,1,0},
{1,1,1,1,0},
{1,0,1,1,1},
{1,1,1,1,0},
{1,0,1,1,1},
{1,1,1,1,0},
{0,1,0,1,0}
};

long time = 0;
long delayTime = 500;
long countTime = 500;

void setup()
{
  for(int i=12; i>=1; i--){
    pinMode(i,OUTPUT);
  }
  digitalWrite(colum1, HIGH);
  digitalWrite(colum2, HIGH);
  digitalWrite(colum3, HIGH);
  digitalWrite(colum4, HIGH);
  digitalWrite(colum5, HIGH);

}

void loop()
{
  time = millis();
  for(int j=0; j<=6;j++)
  {
  for(int i = 0; i<=4;i++)
  {
   if(time <= delayTime)
   {
     pulsLED(j,i,herzchen[j][i]);
   }else if(time <= (delayTime+(countTime*1))){
    pulsLED(j,i,mal[j][i]);
   }else if(time <= (delayTime+(countTime*2))){
    pulsLED(j,i,fisch[j][i]);
   }else if(time <= (delayTime+(countTime*3))){
    pulsLED(j,i,gleich[j][i]);
   }else if(time <= (delayTime+(countTime*4))){
    pulsLED(j,i,monster[j][i]);
   }else if(time <= (delayTime+(countTime*5))){
    delayTime=delayTime+(countTime*6);
   }
  }
  }

}

void pulsLED(int x,int y,int t){
  digitalWrite(colum[y], LOW);
  digitalWrite(row[x], t);
  delayMicroseconds(100);
  digitalWrite(colum[y], HIGH);
  digitalWrite(row[x], LOW);

}
YouTube Preview Image
#define colum1 8
#define colum2 12
#define colum3 10
#define colum4 9
#define colum5 11
//
#define row1 6
#define row2 5
#define row3 7
#define row4 3
#define row5 4
#define row6 2
#define row7 1

int colum[5] ={colum1,colum2,colum3,colum4,colum5};
int row[7]={row1,row2,row3,row4,row5,row6,row7};
//

int fisch1[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,1,0,0}
};
int fisch2[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,1,0,0},
{0,1,1,1,0}
};
int fisch3[7][5]={
{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,1,1,1,0},
{1,1,1,1,0}
};
int fisch4[7][5]={
{0,0,0,0,0},
{0,0,0,0,0},
{0,0,0,0,0},
{0,0,1,0,0},
{0,1,1,1,0},
{1,1,1,1,0},
{1,1,1,1,1}
};
int fisch5[7][5]={
{0,0,0,0,0},
{0,0,0,0,0},
{0,0,1,0,0},
{0,1,1,1,0},
{1,1,1,1,0},
{1,1,1,1,1},
{0,1,1,1,0}
};

int fisch6[7][5]={
{0,0,0,0,0},
{0,0,1,0,0},
{0,1,1,1,0},
{1,1,1,1,0},
{1,1,1,1,1},
{0,1,1,1,0},
{0,0,1,0,0}
};

int fisch7[7][5]={
{0,0,1,0,0},
{0,1,1,1,0},
{1,1,1,1,0},
{1,1,1,1,1},
{0,1,1,1,0},
{0,0,1,0,0},
{0,1,0,1,0}
};
int fisch8[7][5]={
{0,1,1,1,0},
{1,1,1,1,0},
{1,1,1,1,1},
{0,1,1,1,0},
{0,0,1,0,0},
{0,1,0,1,0},
{0,0,0,0,0}
};
int fisch9[7][5]={
{1,1,1,1,0},
{1,1,1,1,1},
{0,1,1,1,0},
{0,0,1,0,0},
{0,1,0,1,0},
{0,0,0,0,0},
{0,0,0,0,0}
};
int fisch10[7][5]={
{1,1,1,1,1},
{0,1,1,1,0},
{0,0,1,0,0},
{0,1,0,1,0},
{0,0,0,0,0},
{0,0,0,0,0},
{0,0,0,0,0}
};
int fisch11[7][5]={
{0,1,1,1,0},
{0,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}
};
int fisch12[7][5]={
{0,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},
{0,0,0,0,0}
};
int fisch13[7][5]={
{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},
{0,0,0,0,0}
};
int fisch14[7][5]={
{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},
{0,0,0,0,0}
};





long time = 0;
long delayTime = 200;
long countTime = 200;

void setup()
{
  for(int i=12; i>=1; i--){
    pinMode(i,OUTPUT);
  }
  digitalWrite(colum1, HIGH);
  digitalWrite(colum2, HIGH);
  digitalWrite(colum3, HIGH);
  digitalWrite(colum4, HIGH);
  digitalWrite(colum5, HIGH);

}

void loop()
{
  time = millis();
  for(int j=0; j<=6;j++)
  {
  for(int i = 0; i<=4;i++)
  {
   if(time <= delayTime)
   {
     pulsLED(j,i,fisch1[j][i]);
   }else if(time <= (delayTime+(countTime*1))){
    pulsLED(j,i,fisch2[j][i]);
   }else if(time <= (delayTime+(countTime*2))){
    pulsLED(j,i,fisch3[j][i]);
   }else if(time <= (delayTime+(countTime*3))){
    pulsLED(j,i,fisch4[j][i]);
   }else if(time <= (delayTime+(countTime*4))){
    pulsLED(j,i,fisch5[j][i]);
   }else if(time <= (delayTime+(countTime*5))){
    pulsLED(j,i,fisch6[j][i]);
   }else if(time <= (delayTime+(countTime*6))){
    pulsLED(j,i,fisch7[j][i]);
   }else if(time <= (delayTime+(countTime*7))){
    pulsLED(j,i,fisch8[j][i]);
   }else if(time <= (delayTime+(countTime*8))){
    pulsLED(j,i,fisch9[j][i]);
   }else if(time <= (delayTime+(countTime*9))){
    pulsLED(j,i,fisch10[j][i]);
   }else if(time <= (delayTime+(countTime*10))){
    pulsLED(j,i,fisch11[j][i]);
   }else if(time <= (delayTime+(countTime*11))){
    pulsLED(j,i,fisch12[j][i]);
   }else if(time <= (delayTime+(countTime*12))){
    pulsLED(j,i,fisch13[j][i]);
   }else if(time <= (delayTime+(countTime*13))){
    delayTime=delayTime+(countTime*13);
   }
  }
  }

}

void pulsLED(int x,int y,int t){
  digitalWrite(colum[y], LOW);
  digitalWrite(row[x], t);
  delayMicroseconds(100);
  digitalWrite(colum[y], HIGH);
  digitalWrite(row[x], LOW);


}