Blogroll

Powered by Blogger.

Thursday, 9 October 2014

Turn on LEDs Connected to "neg2" Terminal of 3*3*3 LED Cube (Part 3 of 10)

by realfinetime  |  in LED Cube at  21:28

<<<<  Read Previous Part (Part 2)

Arduino program to turn on LEDs connected to "neg2" terminals of LED Cube.

          We had already seen the circuit for 3*3*3 LED cube in previous blog. Here, we will generate a program to turn on the LEDs connected to "neg2" terminal of 3*3*3 LED cube. LED cube will be as shown below.

Now upload the following program to your arduino board.

int neg1 = 13;  //"neg1" is connected to the 13th digital pin of arduino
int neg2 = 12;  //"neg2" is connected to the 12th digital pin of arduino
int neg3 = 11;  //"neg3" is connected to the 11th digital pin of arduino
int neg4 = 10;  //"neg4" is connected to the 10th digital pin of arduino
int neg5 = 9;   //"neg5" is connected to the 9th digital pin of arduino
int neg6 = 8;   //"neg6" is connected to the 8th digital pin of arduino
int neg7 = 7;   //"neg7" is connected to the 7th digital pin of arduino
int neg8 = 6;   //"neg8" is connected to the 6th digital pin of arduino
int neg9 = 5;   //"neg9" is connected to the 5th digital pin of arduino

int pos1 = 4;   //"pos1" is connected to the 4th digital pin of arduino
int pos2 = 3;   //"pos2" is connected to the 3rd digital pin of arduino
int pos3 = 2;   //"pos3" is connected to the 2nd digital pin of arduino

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pins as an output.
  pinMode(neg1, OUTPUT);     
  pinMode(neg2, OUTPUT);     
  pinMode(neg3, OUTPUT);     
  pinMode(neg4, OUTPUT);     
  pinMode(neg5, OUTPUT);     
  pinMode(neg6, OUTPUT);     
  pinMode(neg7, OUTPUT);     
  pinMode(neg8, OUTPUT);     
  pinMode(neg9, OUTPUT);  
  
  pinMode(pos1, OUTPUT);     
  pinMode(pos2, OUTPUT);     
  pinMode(pos3, OUTPUT);     
}

// the loop routine runs over and over again forever:
void loop() {
    digitalWrite(pos1, HIGH);
    digitalWrite(pos2, HIGH);
    digitalWrite(pos3, HIGH);
  
    digitalWrite(neg1, HIGH);
    digitalWrite(neg2, LOW);
    digitalWrite(neg3, HIGH);
    digitalWrite(neg4, HIGH);
    digitalWrite(neg5, HIGH);
    digitalWrite(neg6, HIGH);
    digitalWrite(neg7, HIGH);
    digitalWrite(neg8, HIGH);
    digitalWrite(neg9, HIGH);
}

          If uploading is successful all the LEDs connected to the "neg2" terminal of LED cube will turn on. From the circuit, it is clear that, if high voltage is given to "pos1", "pos2", "pos3" etc and negative voltage is given to "neg2", LEDs connected to the "neg2" terminal will turn on and all other LEDs will turn off as shown in the circuit.

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.