/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
#define DIM 2
#define DIM1 (DIM-1)
typedef byte Frame[DIM];
int cols[DIM]={8,9};
int rows[DIM]={6,7};
int pinVals[DIM][DIM];
boolean lit=false;
Frame blankFrame={B00,
B00};
//Frame fullFrame={B11,
// B11};
byte *currentFrame=blankFrame;
int curFrame=0;
Frame Frames[4]={
{B10,
B00},
{B01,
B00},
{B00,
B10},
{B00,
B01}};
void setFrame()
{
curFrame++;
if(curFrame>4)
curFrame=0;
currentFrame=Frames[curFrame];
}
void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
int i;
for(i=0;i
pinMode(cols[i],OUTPUT);
pinMode(rows[i],OUTPUT);
}
}
void loop() {
int c=HIGH;
int r=LOW;
if(lit)
{
c=LOW;
r=HIGH;
}
//Just tests connections, doesn't use frames
int i;
for (i=0;i < DIM;i++)
{
digitalWrite(rows[i],LOW);
for (int j=0;j < DIM;j++) {
digitalWrite(cols[j],HIGH);
delay(250);
digitalWrite(cols[j],LOW);
}
digitalWrite(rows[i],HIGH);
}
setFrame();
delay(400); // wait for a second
}
No comments:
Post a Comment