Blogroll

Powered by Blogger.

Wednesday, 1 October 2014

Arduino Program to Blink LED 1 of 2*2*2 LED Cube (Part 7 of 13)

by realfinetime  |  in LED Cube at  09:44

<<<<  Read Previous Part (Part 6)

          We had seen the circuit for connecting 2*2*2 LED cube to arduino mega in the last blog. Here, we will upload some programs to the arduino board to control LEDs in 2*2*2 LED cube individually.

Program to blink LED 1

          Upload the following program to your arduino board. If uploading is successful, LED 1 will start blinking.

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);   
}

// the loop routine runs over and over again forever:
void loop() {

  //Turn on LED 1 for 500 mS
  digitalWrite(8, HIGH);  //Send HIGH to the "f" terminal of LED cube 
  digitalWrite(9, LOW);   //Send LOW to the "e" terminal of LED cube 
  digitalWrite(10, HIGH); //Send HIGH to the "d" terminal of LED cube 
  digitalWrite(11, HIGH); //Send HIGH to the "c" terminal of LED cube  
  digitalWrite(12, HIGH); //Send HIGH to the "b" terminal of LED cube 
  digitalWrite(13, LOW);  //Send LOW to the "a" terminal of LED cube 
  
  delay(500);
  
  //Turn off LED 1 for 500 mS
  digitalWrite(8, LOW);   //Send LOW to the "f" terminal of LED cube 
  digitalWrite(9, LOW);   //Send LOW to the "e" terminal of LED cube 
  
  delay(500);
}


Program to blink LED 2

          Upload the following program to your arduino board. If uploading is successful, LED 2 will start blinking.

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);   
}

// the loop routine runs over and over again forever:
void loop() {

  //Turn on LED 2 for 500 mS
  digitalWrite(8, HIGH);  //Send HIGH to the "f" terminal of LED cube 
  digitalWrite(9, LOW);   //Send LOW to the "e" terminal of LED cube 
  digitalWrite(10, HIGH); //Send HIGH to the "d" terminal of LED cube 
  digitalWrite(11, HIGH); //Send HIGH to the "c" terminal of LED cube  
  digitalWrite(12, LOW);  //Send LOW to the "b" terminal of LED cube 
  digitalWrite(13, HIGH); //Send HIGH to the "a" terminal of LED cube 
  
  delay(500);
  
  //Turn off LED 1 for 500 mS
  digitalWrite(8, LOW);   //Send LOW to the "f" terminal of LED cube 
  digitalWrite(9, LOW);   //Send LOW to the "e" terminal of LED cube 
  
  delay(500);
}


Program to blink LED 3

          Upload the following program to your arduino board. If uploading is successful, LED 3 will start blinking.

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);   
}

// the loop routine runs over and over again forever:
void loop() {

  //Turn on LED 3 for 500 mS
  digitalWrite(8, HIGH);  //Send HIGH to the "f" terminal of LED cube 
  digitalWrite(9, LOW);   //Send LOW to the "e" terminal of LED cube 
  digitalWrite(10, HIGH); //Send HIGH to the "d" terminal of LED cube 
  digitalWrite(11, LOW);  //Send LOW to the "c" terminal of LED cube  
  digitalWrite(12, HIGH); //Send HIGH to the "b" terminal of LED cube 
  digitalWrite(13, HIGH); //Send HIGH to the "a" terminal of LED cube 
  
  delay(500);
  
  //Turn off LED 1 for 500 mS
  digitalWrite(8, LOW);   //Send LOW to the "f" terminal of LED cube 
  digitalWrite(9, LOW);   //Send LOW to the "e" terminal of LED cube 
  
  delay(500);
}


Continued in Next Part (Part 8)  >>>

0 comments:

IMPORTANT NOTICE

All the circuits, published in this blog is only after testing and getting proper results in my private lab. When you try these circuits, you should check the supply voltage, polarity of components, presence of childrens nearby and shorts in the circuits. This website will not be responsible for any harm happened to you or your components caused by your carelessness.

For More Electronic Tips

Blog Archive

Proudly Powered by Blogger.