Professional Documents
Culture Documents
Led Cube Display
Led Cube Display
Led Cube Display
Submitted by
RANDEEP KUMAR
SHARUK K.A
UNNI V.S
Focus on Excellence
Angamaly-683577, Ernakulam
Affiliated to
Kottayam-686560
May 2011
RANDEEP KUMAR
SHARUK K.A
UNNI V.S
Focus on Excellence
Angamaly-683577, Ernakulam
Affiliated to
May 2011
Focus on Excellence
CERTIFICATE
This is to certify that the mini project report titled 3D LED CUBE DISPLAY
(8x8x8 PIXELS) submitted by Randeep Kumar, Sharuk K.A, Unni V.S,
Vishnu Prasad C.V, towards partial fulfillment of the requirements for the
award of the degree of Bachelor of Technology in Electronics and
Communication Engineering is a record of bonafide work carried out by them
during the academic year 2010 2011
Staff in charge
Place:
Date:
ACKNOWLEDGEMENT
We express our deep sense of gratitude to our principal Dr. K.V Sundaresan who extended
all resources for the successful completion of our project. Mrs. P.R Mini our
HODs well wishes, whole hearted co-operation and contribution one form or another has
helped us throughout this venture.
We
are greatly indebted to our project guides Mrs. Hima Mary John,
Mr.Nandakumar, Mrs. Shamseena M.A for this scholarly assistance, kind treatment
encouragement and timely help in every possible manner. We feel it due mentioning the
dedication, sincerity and whole hearted co-operation that they extended to us. We hereby
extended our sincere thanks to the laboratory staff Mrs. Bini T Abraham and all others as
well for giving their support in realizing the goal.
Our sincere gratitude is expressed and extended to all our friends and to all those who have
contributed directly or indirectly to make this endeavour a success. Above all, we express
our overwhelming gratitude to the almighty for the success of our project. Without the
divine grace, our dream project wouldnt have materialized.
ABSTRACT
The project is a 3D LED CUBE DISPLAY (8x8x8 PIXELS) which displays different
patterns stored in the microcontroller. This LED cube is like a LED screen, but it is special
in that it has a third dimension, making it 3D. Think of it as many transparent low
resolution displays. In normal displays it is normal to try to stack the pixels as close as
possible in order to make it look better, but in a cube one must be able to see through it, and
more spacing between the pixels (actually it's voxels since it is in 3d) is needed. The
spacing is a trade-off between how easy the layers behind it are seen, and voxel fidelity.
Since it is a lot more work making a LED cube than a LED display, they are usually low
resolution. A LED display of 8x8 pixels are only 64 LEDs, but a LED cube in 8x8x8 is 512
LEDs, an order of magnitude harder to make! This is the reason LED cubes are only made
in low resolution. A LED cube does not have to be symmetrical; it is possible to make a
7x8x9, or even oddly shaped ones. Here we have an 8x8x8 shaped one. The code is written
in the C language using AVR studio and it is burned into the microcontroller using the pony
prog 2000.The circuit needs to be mounted on the mechanical structure or platform where it
displays the patterns that are stored in the microcontroller as indicated in the codes. The
patterns are displayed on a 3D structure which is made up of stainless steel rods. The
messages can be changed as per user need by rewriting the microcontrollers in-built
memory. The complete display system circuit is power supply run on 5V, 2A which is
provided externally. This unique way of displaying messages is a very eye catching;
therefore its uses can in the field of advertising, toys, etc
CONTENTS
Page No
Chapter 1
INTRODUCTION
1
Chapter 2
BLOCK DIAGRAM AND EXPLANATION
2
2.1
Block diagram
2
2.2
Explanation
3
Chapter 3
CIRCUIT DIAGRAMS AND EXPLANATION 5
3.1
Circuit Diagrams
6
3.1.1
Schematic Controller Board
6
3.1.2
Wiring 3x3x3 LED Cube
7
3.2
Explanation
8
Chapter 4
PCB
10
4.1
PCB Component Layout
10
4.2
Jumper Layer
11
4.3
Soldering Layer
12
4.4
PCB Fabrication
13
Chapter 5
HARDWARE AND SOFTWARE SECTION
15
5.1
Hardware section
15
5.2
Software platforms used
16
5.3
Flow chart
19
Chapter 6
RESULTS
21
Chapter 7
CONCLUSION & FUTURE SCOPE
22
Components List
23
References
24
Appendix
25
1. INTRODUCTION
1. INTRODUCTION
A microcontroller is a computer. All computers whether talk about a personal desktop computer
or a large mainframe computer or microcontrollers have several things in common like the CPU
(central processing unit), execution of programs, presence of RAM (random-access memory)
etc Microcontrollers are special purpose computers.
Microcontrollers are often low- power devices. A desktop computer is almost always plugged
into a wall socket and might consume 50 watts of electricity. A microcontroller has a dedicated
input device and often (but not always) has a small LED or LCD display for output. A
microcontroller is often small and low cost. Today the technology has advanced to such an extent
that has come a need to display electronic messages to satisfy all purposes, whether it is business
or domestic use. The solution found to satisfy this need is the matrix display systems using
LEDs and LCDs. Different kinds of matrix systems are available today which are capable of
displaying messages, graphics, logos and moving animation that are sure to capture and hold the
attention of any audience. It provides instantaneous, flexible communications when and where
theyre needed most. This LED cube has 512 LEDs. Obviously, having a dedicated IO port for
each LED would be very impractical. We would need a micro controller with 512 IO ports, and
run 512 wires through the cube. Instead, LED cubes rely on an optical phenomenon called
persistence of vision (POV).If we flash a led really fast, the image will stay on our retina for a
little while after the led turns off. By flashing each layer of the cube one after another really fast,
it gives the illusion of a 3d image, when in fact we are looking at a series of 2d images stacked
onto one another. This is also called multiplexing. With this setup, we only need 64 (for the
anodes) + 8 (for each layer) IO ports to control the LED cube. The main purpose of our project is
to build a 3D LED cube display using an ATMEGA32, high performance, low power Atmel AVR
8-bit Microcontroller. It has advanced RISC architecture and 131 powerful instructions with
most single clock cycle execution and 32 x 8 general purpose working registers. Its function is to
display the different patterns in 3D using 512 LEDs.
By moving them fast enough, the output will be a human identifiable pattern or character.
230 V, 50 Hz AC Supply
2.2 Explanation
Power supply is used to provide a +5 volt, 2A from 230V 50Hz ac supply with the use of bridge
rectifier and regulator.
2.2.2 Microcontroller
Microcontroller ATMEGA32 is used to control the D latch and MOSFET. The ATMEGA32 is a
low power, high performance CMOS 8-bit microcomputer with 32K bytes of Flash
programmable and 1K bytes of EEPROM .The on chip Flash allows the program memory to be
reprogrammed in system or by a conventional nonvolatile memory programmer. It has 32x8
general purpose working registers with 131 powerful instructions.
The 74HC/HCT573 are high-speed Si-gate CMOS devices and are pin compatible with low
power Schottky TTL (LSTTL). They are specified incompliance with JEDEC standard
no.7A.The 74HC/HCT573 are octal D-type transparent latches
featuring separate D-type inputs for each latch and 3-state outputs for bus oriented applications.
A latch enable (LE) input and an output enable (OE) input are common to all latches.
This 3D led cube is made up of stainless steel rods with 512 leds. There are
64 anodes 8 cathodes. The LED cube is made up of columns and layers. The cathode legs of
every LED in a layer are soldered together. All the anode legs in one column are soldered
together. Each of the 64 columns is connected to the controller board with a separate wire. Each
column can be controlled individually. Each of the 8 layers also has a separate wire going to the
controller board. Each of the layers is connected to a transistor that enables the cube to turn on
and off the flow of current through each layer.
The components used in the Fig 3.1 and their values are given below,
Microcontroller
ATMEGA32-P
Q1 - Q8 (N-Mosfet) IRFZ44
P1
2 Pin Header
P2
ISP Header
P3 P11
8 Pin Header
U2 U9 (D Latch) 74HC573
R2 R9
1K Resistors
C1, C3 22PF
C2
10PF
20
3.2 Explanation
A LED cube is like a LED screen, but it is special in that it has a third dimension, making it 3D.
Think of it as many transparent low resolution displays. In normal displays it is normal to try to
stack the pixels as close as possible in order to make it look better, but in a cube one must be able
to see trough it, and more spacing between the pixels (actually it's voxels since it is in 3d) is
needed. The spacing is a trade-off between how easy the layers behind it are seen, and voxel
fidelity. Since it is a lot more work making a LED cube than a LED display, they are usually low
resolution. A LED display of 8x8 pixels are only 64 LEDs, but a LED cube in 8x8x8 is 512
LEDs, an order of magnitude harder to make! This is the reason LED cubes are only made in low
resolution. A LED cube does not have to be symmetrical; it is possible to make a 7x8x9, or even
oddly shaped ones.
This LED cube has 512 LEDs. Obviously, having a dedicated IO port for each LED would be
very impractical. Thus there comes the need of a micro controller with 512 IO ports, and run 512
wires through the cube. Instead, LED cubes rely on an optical phenomenon called persistence of
vision (POV). When a led is flashed really fast, the image will stay on the retina for a little while
after the led turns off. By flashing each layer of the cube one after another really fast, it gives the
illusion of a 3d image, when in fact we are looking at a series of 2d images stacked onto one
another. This is also called multiplexing. With this setup, there exists the need of only 64 (for the
anodes) + 8 (for each layer) IO ports to control the LED cube. There are anodes, cathodes,
columns and layers,
for
this
led
cube.
In order to light up an LED, we have to run current from the anode to the cathode. The LED cube
is made up of columns and layers. The cathode legs of every LED in a layer are soldered
together. All the anode legs in one column are soldered together. Each of the 64 columns is
connected to the controller board with a separate wire. Each column can be
controlled individually. Each of the 8 layers also has a separate wire going to the controller
board. Each of the layers is connected to a transistor that enables the cube to turn on and off the
flow of current through each layer. By only turning on the transistor for one layer, current from
the anode columns can only flow through that layer. The transistors for the other layers are off,
and the image outputted on the 64 anode wires are only shown on the selected layer. To display
the next layer, simply turn off the transistor for the current layer, change the image on the 64
anode wires to the image for the next layer. Then turn on the
transistor
for
the
next
layer.
Rinse
and
repeat
very
fast.
The layers
will
be
referred to
as
layers, cathode
layers or
ground
layers.
The columns will be referred to as columns, anode columns or anodes.
The control unit is quite simple, 3 ports of the Mega32 were used:
one port controls 8 FETs for sinking the 8 ground layers one port is wired to all 8 8bit d-latch
inputs
Since the d-latches are only able to sink or source 70mA on all 8 latches, we had to limit the
diode current to ~9mA, which is fairly enough for this type of LED.
4.
PCB
4. PCB
A printed circuit board, or PCB, is used to mechanically support and electrically connect
electronic components using conductive pathways, tracks or traces etched from copper sheets
laminated onto a non-conductive substrate. It is also referred to as printed wiring board (PWB) or
etched wiring board. A PCB populated with electronic components is a printed circuit board
assembly (PCBA).
PCBs are inexpensive, and can be highly reliable. They require much more layout effort and
higher initial cost than either wire-wrapped or pint-to-point constructed circuits, but are much
cheaper and faster for high- volume production. Much of the electronics industrys PCB design,
assembly and quality control needs are set by standards that are published by the IPC
organization.
4.4.1 materials
Conducting layers are typically made of thin copper foil. Insulating layers dielectric are typically
laminated together with epoxy resin prepreg. The board is typically coated with a solder mask
that is green in color. Other colors that are normally available are blue and red. There are quite a
few different dielectrics that can be chosen to provide different insulating values depending on
the requirements of the circuit. Some of these dielectrics are polytetrafluroethylene (Teflon), FR4, FR-1, CEM-1 or CEM-3. Well known prepreg materials used in the PCB industry are FR-2
(Phenolic cotton paper), FR-3 (Cotton paper and epoxy), FR-4 (Woven glass and epoxy), FR-5
(Woven glass and epoxy), FR-6 (Matte glass and polyester), G-10 (Woven glass and epoxy),
CEM-1 (Cotton paper and epoxy), CEM-2 (Cotton paper and epoxy) CEM-3 (Woven glass and
epoxy), CEM-4 (Woven glass and epoxy), CEM-5 (Woven glass and polyester). Thermal
expansion is an important consideration especially with BGA and naked die technologies, and
glass fiber offers the best dimensional stability.
The vast majority of printed circuit boards are made by bonding a layer of copper over the entire
substrate, sometimes on both sides, (creating a blank PCB) then removing unwanted copper
after applying a temporary mask (e.g. by etching), leaving only the desired copper traces. A few
PCBs are made by adding traces to the substrate (or a substrate with a very thin layer of copper)
usually by a complex process of multiple electroplating steps.
There are three common subtractive methods (methods that remove copper) used for the
production of printed circuit boards.
Silk Screen printing uses etch-resistant inks to protect the copper foil. Subsequent etching
removes the unwanted copper. Alternatively, the ink may be conductive, printed on a blank (non
conductive) board. The latter technique is also used in the manufacture of hybrid circuits.
Photoengraving uses a photomask and chemical etching to remove the copper foil from the
substrate. The photomask is usually prepared with a photo plotter from data produced by a
technician using CAM, or computer-aided manufacturing software.
PCB milling uses a two or three-axis mechanical milling system to mill away the copper foil
from the substrate. A PCB milling machine (referred to as a PCB Prototype) operates
in a similar way to a plotter of the milling head in the x, y, and (if relevant z axis). Data to drive
the Prototypes is extracted from files generated in PCB design software and stored in HPGL or
Gerber file format.
This simple AVR Programmer will allow you to painlessly transfer hex programs to most
ATMEL AVR microcontrollers without sacrificing your budget and time. It is more reliable than
most other simple AVR programmers available out there and can be built in very short amount of
time.
AVR Studio is used by embedded programmers for programming and debugging for many of the
Atmel microprocessors such as the Atmega8 or even the Atmega128. While it has support for
assembly programming for those who prefer to use higher languages, it uses the coff format for
debugging. Beginning with version 4 AVR Studio has now moved to dwarf2, and can be more
readily used in conjunction with the open source gcc based compiler WinAVR.
Pony Prog is a serial device programmer software with a user-friendly GUI frame work available
for Windows95, 98, 2000 & NT and Intel Linux. Its purpose is reading and writing every serial
device. At the moment it supports IC Bus, Micro wire, SPI EEPROM, the Atmel AVR and
Microchip PIC micro.
ATMEGA32
START
Port Configurations
Initialization
While (1)
YES
Display
String
FISAT
Call Block
wipe ()
Rotate string
3D
Call functions block wipe (), cube_2_auto (), cube_wipe (), cube_waves (),
.thank you");
6. RESULTS
6. RESULTS
After successfully completing this project we came to know more about our project. It gave us a
lot of experience which will help in our future. The main advantages and limitations of the
project were identified. There are many applications for our project like in the field of
advertising, for making toys, to use as a study material, etc. but the only limitation of this
project we had found is that it requires complete darkness, as it deals with the light. Since it
consists of the LEDs it should be kept in a dark room for the perfect output.
We were successful in completing our mini project 3D LED CUBE DISPLAY (8x8x8 Pixels).
It was a wonderful experience as we attained basic knowledge on different steps in circuit
manufacturing such as circuit testing and debugging, soldering components, PCB fabrication etc
that will surely help us in our career in electronics field. By doing this project we also came to
know about the advantages and disadvantages of our project and its future development. Today
we have a 3D world; a 3D revolution will be formed in the upcoming years. This project can be
upgraded to a great extent by suitable add-ons and we expect a bright future for our project in the
coming years. The main applications of our project include toys, advertisements, study material,
research purposes etc
SL.NO:
COMPONENT
SPECIFICATION
QUANTITY
1
LEDS
BLUE COLOR,
512
DOM TYPE
2
RESISTORS
20 , 1K, 10K,
64, 8, 2, 3, 3
22K, 4.7K
3
MOSFET
IRFZ44 (N
8
CHANNEL)
4
LARGE PROTOTYPE
MEDIUM SIZE
3
PCBS
5
MICROCONTROLLER
ATMEGA32
1
6
D LATCH
74HC573
8
7
CAPACITORS
22PF, .01F
5, 5
8
TRANSISTOR
BC547
1
9
CRYSTAL
16MHz
1
OSCILLATOR
10
POWER SUPPLY
5V, 2A
1
11
SERIAL CABLE AND
FOR
1
HEADER
12
STAINLESS STEEL
FOR THE
1.25 KG
RODS
STRUCTURE
13
8 PIN CONNECTORS
WITH JACK
18
14
HEAT SINKS
WING TYPE
8
15
MISCELLANEOUS
-
References
Available: http://www.atmel.com/dyn/resources/prod_documents/doc2503.pdf
(2011, Apr). Atmel AVR Microcontroller Primer: Programming and Interfacing (Synthesis
Lectures on Digital Circuits and Systems)
(2000, Sep).
(2005-2010).
(2005-2010).
APPENDIX
Program
Header Files
AB
#include <inttypes.h>
#endif
ANIMATIONS
LEDCUBE
uint8_t cube[8][8];
void cube_cube_3 ( void ); void cube_cube_4_line ( void ); void cube_random( void ); void
cube_test_z( void );
TRANSLATION
void move_z_fwd ( uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2 ); void move_z_rev ( uint8_t x1,
uint8_t y1, uint8_t x2, uint8_t y2 ); void move_y_fwd( uint8_t x1, uint8_t y1, uint8_t x2, uint8_t
y2 ); void move_y_rev( uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2 ); void move_x_fwd( uint8_t
x1, uint8_t y1, uint8_t x2, uint8_t y2 ); void move_x_rev( uint8_t x1, uint8_t y1, uint8_t x2, uint8_t
y2 );
#endif
ROTATION
void rotate_15_deg( void ); void rotate_30_deg( void ); void rotate_45_deg( void ); void
rotate_60_deg( void ); void rotate_75_deg( void ); void rotate_90_deg( void );
#endif
Source Files
AB
{
switch (ch)
{
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '9':
case '!':
case '.':
case '?':
case '&':
cube[0][2] |= z;
case 'a':
case 'b':
case 'c':
case 'd':
case 'f':
case 'g':
case 'h':
case 'i':
case 'k':
case 'l':
case 'n':
case 'o':
cube[6][4] |= z; break;
case 'p':
case 'r':
case 's':
case 'u':
case 'w':
case 'y':
default:
break;
}
}
ANIMATIONS
cube_clear();
for (uint8_t i = 0; i < 8; i++) { cube[0][0] |= ( 1 << i ); cube[1][7] |= ( 1 << (7-i) ); cube[2][0] |= ( 1
<< i ); cube[3][7] |= ( 1 << (7-i) ); cube[4][0] |= ( 1 << i ); cube[5][7] |= ( 1 << (7-i) ); cube[6][0] |=
( 1 << i ); cube[7][7] |= ( 1 << (7-i) );
cube_show_loop(STRIPES_DELAY);
}
for (uint8_t i = 0; i < 8; i++) { cube[0][j] |= ( 1 << i ); cube[1][7-j] |= ( 1 << i ); cube[2][j] |= ( 1 <<
i ); cube[3][7-j] |= ( 1 << i ); cube[4][j] |= ( 1 << i ); cube[5][7-j] |= ( 1 << i ); cube[6][j] |= ( 1 << i );
cube[7][7-j] |= ( 1 << i );
}
cube_show_loop(STRIPES_DELAY);
}
{
cube_clear();
char cube2_arr[4][4];
cube2_arr[0][0] |= (1 << 0); cube2_arr[0][1] |= (1 << 0); cube2_arr[0][2] |= (1 << 0); cube2_arr[0][3]
|= (1 << 0);
cube2_arr[1][0] |= (1 << 0); cube2_arr[1][1] |= (1 << 0); cube2_arr[1][2] |= (1 << 0); cube2_arr[1][3]
|= (1 << 0); cube2_arr[0][0] |= (1 << 1); cube2_arr[0][1] |= (1 << 1); cube2_arr[0][2] |= (1 << 1);
cube2_arr[0][3] |= (1 << 1);
cube2_arr[0][0] |= (1 << 2); cube2_arr[0][1] |= (1 << 2); cube2_arr[0][2] |= (1 << 2); cube2_arr[0][3]
|= (1 << 2);
for (uint16_t i = 0; i < 2000; i++) { uint8_t x = rand()%4; uint8_t y = rand()%4; uint8_t z =
rand()%4;
switch (rand()%6)
{
case 0:
while(y < 3) {
if (cube2_move_y_fwd(cube2_arr, y, x, z) == 0)
{
cube_2_auto_show(cube2_arr); y++;
} else { break; }
}
break;
case 1:
while(y > 0) {
if (cube2_move_y_rev(cube2_arr, y, x, z) == 0)
{
cube_2_auto_show(cube2_arr); y--;
} else { break; }
}
break;
case 2:
while(x < 3) {
if (cube2_move_x_fwd(cube2_arr, y, x, z) == 0)
{
cube_2_auto_show(cube2_arr); x++;
} else { break; }
}
break;
case 3:
while(x > 0) {
if (cube2_move_x_rev(cube2_arr, y, x, z) == 0)
{
cube_2_auto_show(cube2_arr); x--;
} else { break; }
}
break;
case 4:
while(z < 3) {
if (cube2_move_z_fwd(cube2_arr, y, x, z) == 0)
cube_2_auto_show(cube2_arr); z++;
} else { break; }
}
break;
case 5:
while(z > 0) {
if (cube2_move_z_rev(cube2_arr, y, x, z) == 0)
{
cube_2_auto_show(cube2_arr); z--;
} else { break; }
}
break;
default:
break;
}
}
}
if (!(cube2[y+1][x] & (1 << z))){ cube2[y][x] &= ~(1 << z); cube2[y+1][x] |= (1 << z); return 0;
return 1;
}
if (!(cube2[y-1][x] & (1 << z))){ cube2[y][x] &= ~(1 << z); cube2[y-1][x] |= (1 << z); return 0;
return 1;
}
if (!(cube2[y][x+1] & (1 << z))){ cube2[y][x] &= ~(1 << z); cube2[y][x+1] |= (1 << z); return 0;
return 1;
}
if (!(cube2[y][x-1] & (1 << z))){ cube2[y][x] &= ~(1 << z); cube2[y][x-1] |= (1 << z); return 0;
}
return 1;
if (!(cube2[y][x] & (1 << (z+1)))){ cube2[y][x] &= ~(1 << z); cube2[y][x] |= (1 << (z+1)); return
0;
}
return 1;
if (!(cube2[y][x] & (1 << (z-1)))){ cube2[y][x] &= ~(1 << z); cube2[y][x] |= (1 << (z-1)); return
0;
}
return 1;
cube_clear_layer(layer*2+1); cube_clear_layer(layer*2);
}
}
}
cube_show_loop(CUBE_AUTO_DELAY);
{
cube_clear();
}
for (uint8_t i = 0; i < 2; i++) {
move_y_rev(4,0,5,1); cube_show_loop(CUBES2_DELAY);
}
cube_show_loop(CUBES2_DELAY*10);
cube_clear();
}
cube_show_loop(CUBES4_DELAY);
53
}
}
cube_clear();
cube_show_loop(OUT_SHRINK_DELAY);
cube_show_loop(10*OUT_SHRINK_DELAY);
for (uint8_t k = 3; k <= (i+3); k++){ cube[j][7-k] = led_state; cube[j][k] = led_state; cube[7-j][7-k] =
led_state; cube[7-j][k] = led_state;
led_state &= ~((1 << (3-i)) | (1 << (4+i))); for (uint8_t j = 3; j <= (i+3); j++) {
for (uint8_t k = 3; k <= (i+3); k++){ cube[j][7-k] = led_state; cube[j][k] = led_state; cube[7-j][7-k] =
led_state; cube[7-j][k] = led_state;
}
cube_show_loop(EXPLOSION_DELAY*(2*i+1));
}
cube_show_loop(EXPLOSION_DELAY);
/* wipe */
void cube_wipe( void )
cube_test_y(); cube_show_loop(SWIPE_DELAY);
for (uint8_t layer = 0; layer < 7; layer++){ for (uint8_t i = 0; i < 8; i++){
cube_show_loop(SWIPE_DELAY);
}
char cube_belt[25];
string++;
string++;
while(*string){
show_belt(cube_belt); move_belt_left(cube_belt);
}
string++;
}
}
}
{
for (uint8_t i = 25; i > 1; i--){
belt[i-1] = belt[i-2];
}
belt[0] = 0;
}
cube_clear(); cli();
for (uint8_t layer = 0; layer < 8; layer++) { for (uint8_t i = 1; i < 6; i++){
}
}
cube_clear(); sei();
}
}
/* front side */
for (uint8_t i = 12; i <= 17; i++){ for (uint8_t j = 0; j < 8; j++){
}
/* left side */
for (uint8_t i = 18; i <= 24; i++){ for (uint8_t j = 0; j < 8; j++){
}
}
cube_show_loop(SHOW_BELT_DELAY);
}
cube_clear(); _delay_ms(600);
while(*string) { _delay_ms(200);
cube_clear(); _delay_ms(200);
string++; _delay_ms(300);
cube_show_loop(CUBE_STRING_DELAY); move_x_fwd(1,0,6,7);
cube_show_loop(CUBE_STRING_DELAY); move_x_fwd(1,0,6,7);
cube_show_loop(CUBE_STRING_DELAY); move_x_fwd(1,0,6,7);
cube_show_loop(CUBE_STRING_DELAY); rotate_90_auto(1);
cube_explosion();
}
cube_explosion(); cube_explosion();
cube_show_loop(OUTLINE_DELAY);
for (uint8_t i = 1; i < 8; i++) { cube[7][0] |= (1 << i); cube[7][i] |= 1; cube[i][0] |= 128; cube[0][i] |
= 128; cube[0][7] |= (1 << i); cube[i][7] |= 1;
cube_show_loop(OUTLINE_DELAY);
for (uint8_t i = 1; i < 8; i++) { cube[7][i] |= 128; cube[7][7] |= (1 << i); cube[i][7] |= 128;
cube_show_loop(OUTLINE_DELAY);
cube_show_loop(30); rotate_90_auto( 8 );
cube_clear();
//
cube[randy][randx] &= ~(1 << randz);
cube_show_loop(STARS_DELAY);
}
}
}
cube_clear();
move_x_rev(0,0,7,7); _delay_ms(300);
}
}
cli();
for (uint8_t i = 0; i < 10; i++){ cube_clear(); cube_show_loop(20); uint8_t mode = rand()%5;
cube_show_loop_wo_int(SONIC_DELAY);
cube_clear();
cube_show_loop_wo_int(SONIC_DELAY);
cube_clear();
}
cube_show_loop_wo_int(SONIC_DELAY);
cube_clear();
}
cube_show_loop_wo_int(SONIC_DELAY);
cube_clear();
cube_show_loop_wo_int(SONIC_DELAY);
cube_clear();
}
for (uint8_t deg = 0; deg < mode; deg++){
rotate_90_deg();
}
cube_show_loop_wo_int(SONIC_DELAY);
cube_clear();
}
cube_show_loop_wo_int(SONIC_DELAY);
cube_clear();
}
cube_show_loop_wo_int(SONIC_DELAY);
cube_clear();
}
cube_show_loop_wo_int(SONIC_DELAY);
cube_clear();
cube[layer][7] = 0b00000010;
}
}
cube_show_loop_wo_int(SONIC_DELAY);
cube_clear();
cube_show_loop_wo_int(SONIC_DELAY);
} else {
cube[layer][4] = 0b00011000;
}
cube_show_loop_wo_int(SONIC_DELAY); cube_clear();
cube_show_loop_wo_int(SONIC_DELAY); cube_clear();
cube_show_loop_wo_int(SONIC_DELAY); cube_clear();
cube_show_loop_wo_int(SONIC_DELAY); cube_clear();
cube_show_loop_wo_int(SONIC_DELAY); cube_clear();
cube[layer][7] = 0b10000001;
}
cube_show_loop_wo_int(SONIC_DELAY);
}
}
sei();
cube_clear();
cube_show_loop(BLOCK_WIPE_DELAY); _delay_ms(100);
cube_show_loop(BLOCK_WIPE_DELAY); _delay_ms(100);
cube_show_loop(BLOCK_WIPE_DELAY); _delay_ms(100);
}
for (uint8_t layer = 8; layer != 0; layer--){
}
}
sei();
_delay_ms(BLINK_DELAY*5); _delay_ms(BLINK_DELAY*5);
_delay_ms(BLINK_DELAY*5); _delay_ms(BLINK_DELAY*5);
_delay_ms(BLINK_DELAY*5); _delay_ms(BLINK_DELAY*5);
}
}
TRANSLATION
for (uint8_t i = y1; i <= y2; i++){ cube[x1][i] = (cube[x1][i] << 1);
}
}
for (uint8_t i= y1; i <= y2; i++){ cube[x1][i] = (cube[x1][i] >> 1);
}
}
}
for (uint8_t k = y1; k <= y2; k++) { if ((cube[i-1][j] & (1 << k))){
}
}
for (uint8_t k = y1; k <= y2; k++) { if ((cube[i][j] & (1 << k))){
} else {
cube[i-1][j] &= ~(1 << k);
}
}
for (uint8_t layer = y1; layer <= y2; layer++) { for (uint8_t j = 7; j > 0; j--){
if ((cube[layer][j-1] & (1 << k))){ cube[layer][j] |= (1 << k); cube[layer][j-1] &= ~(1 << k);
} else {
}
}
for (uint8_t layer = y1; layer <= y2; layer++) { for (uint8_t j = 0; j < 7; j++){
for (uint8_t k = x1; k <= x2; k++) {
if ((cube[layer][j+1] & (1 << k))){ cube[layer][j] |= (1 << k); cube[layer][j+1] &= ~(1 << k);
} else {
}
}
ROTATION
for (uint8_t loopcnt = 0; loopcnt < cycle; loopcnt++) {_delay_ms(30); uint8_t cube_org[8][8];
_delay_ms(30);
}
}
cube_clear();
uint8_t cube_org[8][8];
for (uint8_t i = 0; i < 8; i++){
}
}
cube_clear();
for ( uint8_t layer = 0; layer < 8; layer++ ) { for ( uint8_t x = 0; x < 8; x++) {
for ( uint8_t y = 0; y < 8; y++) {
}
}
}
}
LED CUBE
#include <avr/interrupt.h>
ISR( TIMER0_OVF_vect )
asm volatile("nop");
cube_show_layer = 0;
}
}
}
}
}
}
}
{
for (uint8_t i = 0; i < 8; i++){
}
}
}
}
asm volatile("nop");
PORTD = cube[i][j]; asm volatile("nop"); PORTA |= (1 << j); asm volatile("nop"); PORTA = 0;
asm volatile("nop");
}
PORTC |= (1 << i);
_delay_ms(1); PORTC = 0x00; asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm
volatile("nop"); asm volatile("nop");
}
}
MAIN
void init(void)
{
PORTC = 0;
DDRC = 0xFF;
DDRA = 0xFF;
int main(void)
while ( 1 ){ cube_explosion();
}
}