3x3x3 LED Cube Using Arduino

Hey guys, welcome back to Techatronic. In this article, we are going to teach you how you can make your own 3x3x3 LED Cube using Arduino. An LED cube is a 3-D arrangement of many LED bulbs that are connected with each other. Several layers of the connected LED bulbs are placed one above another. You can check out more cool working projects based on Arduino if you like this one. Basically, there are many variants of Arduino boards available in the market but in this project, we use an Arduino UNO board. In our previous article, we have discussed the making of a 4x4x4 LED Cube so you can also check it out. You need a total of 27 LEDs and all of them are of the same color so that the pattern we observe looks more amazing.  You can learn 10+ basic projects and sensors interfacing with well-explained code from our E-book on Arduino. Complete the circuit and then upload the given Arduino code.

How Does it Work?

The cube we made is a 3x3x3 LED Cube with a total of 27 LEDs. You have to specify the location of the LED which you want to turn on. A simple LED pattern with Arduino is given here, you can take a reference from it. You can use an external power supply from batteries or a USB cable to run the pattern. The LEDs glow very fast and in such a way that we observe the different patterns on the cube. There are a total of five amazing patterns. You have to solder the LEDs with each other. Please handle the soldering iron very carefully.

Soldering the Layers

First of all, arrange 9 LEDs in the form of a square with equal distance from each other. Please look at the image given below, place the LEDs in such format, and then solder the negative legs with each other. Solder an additional wire for support as shown. Bent all the positive legs downwards. In the same way, make two more layers then solder the positive legs of each layer with another layer, and on the last layer, you have 9 positive pins.

Components Required

  • Arduino UNO
  • USB cable for uploading the code
  • 27 LEDs
  • three 1K-ohm resistors
  • Breadboard
  • Jumper wires
  • Soldering Iron and wire

Circuit Diagram for the LED Cube

After soldering all three layers of the cube, you have to make the connections according to the given circuit diagram. Attach the negative terminal of the top, middle, and bottom layer with the digital-2, digital-3, and digital-4 pins of the Arduino through a 1K-ohm resistor for each layer. Connect the LEDs’ positive legs, which we obtain on the bottom layer with the Arduino digital pins as shown in the diagram. You can use a zero PCB or a breadboard for making the connections with the Arduino. After completing the wiring, upload the code given below.

Column 1  -> digital-5

Column 2  -> digital-6

Column 3  -> digital-7

Column 4  -> digital-8

Column 5  -> digital-9

Column 6  -> digital-10

Column 7  -> digital-11

Column 8  -> digital-12

Column 9  -> digital-13

Code for the Project

NOTE: Please upload the given code to the Arduino.

 //Techatronic.com/  
 int neg1 = 13;   
 int neg2 = 12;   
 int neg3 = 11;   
 int neg4 = 10;   
 int neg5 = 9;    
 int neg6 = 8;    
 int neg7 = 7;    
 int neg8 = 6;    
 int neg9 = 5;   
 int pos1 = 4;   
 int pos2 = 3;   
 int pos3 = 2;    
 int delay_time=100, j=0;  
 void setup() {          
  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);     
 }  
 void loop() {  
  for(j=0;j<6;j++)  
  {  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, LOW);   
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);    
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, LOW);   
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);   
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);   
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, HIGH);   
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(150);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(delay_time);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
    digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(pos1, HIGH);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(delay_time);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, HIGH);  
   digitalWrite(pos3, HIGH);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(delay_time);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);   
   delay(200);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, LOW);  
   delay(200);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(200);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(200);   
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(200);   
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);   
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(200);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, LOW);  
   delay(200);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(200);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(200);   
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(200);   
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(200);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, LOW);  
   delay(200);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(200);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(200);   
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(200);   
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(200);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, LOW);  
   delay(200);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(200);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(200);   
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(200);   
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(200);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, LOW);  
   delay(200);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(200);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(200);   
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(200);   
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);    
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, HIGH);   
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, HIGH);   
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);   
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);    
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);   
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);  
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);   
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, LOW);   
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);   
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);   
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);    
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, HIGH);  
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, LOW);   
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);   
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, HIGH);  
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);   
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, HIGH);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, HIGH);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, HIGH);   
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);   
   digitalWrite(neg1, LOW);  
   digitalWrite(neg2, HIGH);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, LOW);  
   digitalWrite(neg5, HIGH);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, LOW);  
   digitalWrite(neg8, HIGH);  
   digitalWrite(neg9, LOW);   
   delay(150);  
   digitalWrite(pos1, LOW);  
   digitalWrite(pos2, LOW);  
   digitalWrite(pos3, LOW);  
   digitalWrite(neg1, HIGH);  
   digitalWrite(neg2, LOW);  
   digitalWrite(neg3, LOW);  
   digitalWrite(neg4, HIGH);  
   digitalWrite(neg5, LOW);  
   digitalWrite(neg6, LOW);  
   digitalWrite(neg7, HIGH);  
   digitalWrite(neg8, LOW);  
   digitalWrite(neg9, LOW);  
   delay(150);      
  }  
 }  

We hope that you learned how to make an LED cube using Arduino. If you are facing any errors, do inform us in the comments section below. You can also check out more Tutorials on Arduino and Raspberry Pi.

HAPPY LEARNING!

Leave a Comment