Arduino‎ > ‎Brewing Arduino‎ > ‎

Basic Tutorial by Beginner : Matrix LED Part 2

posted Oct 8, 2010, 12:08 AM by Haris Hashim   [ updated Oct 20, 2010, 10:07 AM ]


Source Code

const int Row4 = 4;
const int Row5 = 5;
const int Col4 = 10;
const int Col5 = 11;


void setup() {   
  pinMode(Row4, OUTPUT);    
  pinMode(Row5, OUTPUT); 
  pinMode(Col4, OUTPUT); 
  pinMode(Col5, OUTPUT); 
  
  digitalWrite(Row4, HIGH);
  digitalWrite(Row5, HIGH);
  digitalWrite(Col4, LOW);
  digitalWrite(Col5, LOW);
}

int iter = 0;

void loop() {  
  
  iter = iter + 1;
  if (iter >= 50)
    iter = 0;

  int milis = 10 * iter;
  
  digitalWrite(Row4, HIGH);
  digitalWrite(Row5, LOW);
  
  digitalWrite(Col4, LOW);
  digitalWrite(Col5, HIGH);
  
  delay(milis);
  
  digitalWrite(Row4, LOW);
  digitalWrite(Row5, HIGH);
    
  digitalWrite(Col4, HIGH);
  digitalWrite(Col5, LOW);
    
  delay(milis);
}



Conversation Element


ą
Haris Hashim,
Oct 8, 2010, 12:25 AM
Comments