please help with this code...

#include <avr/pgmspace.h>

#define COLUMN 8        // Anzahl der Spalten
#define PLANE 5         // Anzahl der Ebenen
#define PLANETIME 3333  // Anzeigedauer einer Ebene
#define TIMECONST 15    // Multiplikator für Anzeigedauer eines Bildes (33 LEDs)

// LED Muster: Eine Zeile besteht aus den 5 Ebenen mit je 8 LEDs (außer Ebene 5 mit einer LED) und der Anzeigedauer
prog_uchar PROGMEM PatternTable[] = {
B11111111, B11111111, B11111111, B11111111, B1, 5,  // Alle LEDs an
B00000000, B00000000, B00000000, B00000000, B0, 1,  // Alle LEDs aus
B11111111, B11111111, B11111111, B11111111, B1, 5,
B00000000, B00000000, B00000000, B00000000, B0, 10,
// Bei Anzeigedauer 0 endet die Schleife
B00000000, B00000000, B00000000, B00000000, B0, 0
};

// Definition der Pins für Ebenen und Spalten (hängt davon ab, wie man sie verlötet hat)
int LedPin[] = {7, 8, 6, 9, 10, 11, 12, 5};
int PlanePin[] = {18, 17, 16, 15, 14};

void setup()
{
	int pin;
	// Pins als OUTPUT initialiseren
	for (pin=0; pin<COLUMN; pin++) {
		pinMode( LedPin[pin], OUTPUT );
	}

	for (pin=0; pin<PLANE; pin++) {
		pinMode( PlanePin[pin], OUTPUT );
	}
}

void loop()
{
	byte PatternBuf[PLANE]; // speichert eine Zeile aus LED Muster
	int PatternIdx;
	byte DisplayTime;
	unsigned long EndTime;
	int plane;
	int patbufidx;
	int ledpin;
	
	// Index in LED Muster setzen
	PatternIdx = 0;
	// Wiederholen solange Anzeigedauer > 0
	do {
		// Zeile aus LED Muster lesen
		memcpy_P( PatternBuf, PatternTable+PatternIdx, PLANE );
		PatternIdx += PLANE;
		// Anzeigedauer lesen
		DisplayTime = pgm_read_byte_near( PatternTable + PatternIdx++ ); 
		// Anzeigedauer für Bild berechnen
		EndTime = millis() + ((unsigned long) DisplayTime) * TIMECONST;
		
		// LEDs der Ebenen immer wieder aufbauen, solange Anzeigedauer für Bild noch nicht erreicht ist
		while ( millis() < EndTime ) {
			patbufidx = 0; // Am Anfang der Zeile beginnen
			// Schleife über Ebenen
			for (plane=0; plane<PLANE; plane++) {
				// vorherige Ebene ausschalten
				if (plane==0) {
				  digitalWrite( PlanePin[PLANE-1], HIGH );
				} else {
				  digitalWrite( PlanePin[plane-1], HIGH );
				}
		
				// Spalten der aktuelle Ebene setzen

				// Ebene 5 gesondert behandeln, da nur eine LED
 				if (plane==PLANE-1) {
				    digitalWrite( LedPin[0], PatternBuf[plane] );
                                } else {
				    // Einzelne Spalten setzen
                                   for (ledpin=0; ledpin<COLUMN; ledpin++) {
				      // Bitoperation zur Ermittlung der einzelnen Bitwerte
				      // Beispiel:
				      // LED Zeile & ledpin (left shift (<<) schiebt ledpin um 1 nach rechts)
				      // B01010000 & B10000000 = 0 (LED leuchtet nicht)
				      // B01010000 & B01000000 = 1 (LED leuchtet)
				      // B01010000 & B00100000 = 0 (LED leuchtet nicht)
 				      digitalWrite( LedPin[ledpin], PatternBuf[plane] & (1 << ledpin) );
				    } 
                                }
		
				// aktuelle Ebene aktivieren
				digitalWrite( PlanePin[plane], LOW );
				// Anzeigedauer für Ebene
				delayMicroseconds( PLANETIME );
			}
		}
	} while (DisplayTime > 0);
}




CAN SOMEONE PLEASE TELL ME HOW TO ADD

please can someone add some code to give a fading effect…please help…dont know much about programming…

What? You didn't like last weeks answer?

please i do not know much about programming can you write it in the existing code..

can you write it in the existing code..

No. As I pointed out last time, the code does not have any mechanism for anything other than ON or OFF for the LEDs.

Depending on what is connected to the Arduino, it may or may not even be possible to fade any LED.

So, what is connected to the Arduino? Just LEDs and resistors, or are there multiplexer chips involved?

just leds are connected but are multiplexed..any suggestions..

Well, I have taken the trouble to read all your posts, domdomgin, and as I see this you want to make the christmas tree. You have manged to construct the tree, right? (that is an achievment if yours looks as neat - and the Arduino circuit and all) But you have no clue what or how the program works. Well, we cant all be experts in everything, so here is a guide on how to modify it. I am intentionally NOT explaining the Arduino, C-code. or workings of the program - just how to edit the "Lightshow". ByTheWay: There is no provision for dimming the LED - it is all on or off. It would require a large rewrite to cope with that.

The supplied code from the wiki just contain code for a simple blink. The author assumed that you want to define your own patterns. You only need to replace the four lines that look like this

B00000000, B00000000, B00000000, B00000000, B0, 10,

These line needs to be repeated and edited to become your "lightshow". The 5 "B"-words are the patterns for each ring. The first word is how the bottom layer LEDs are lit. ie. if the line is

B00000001, B00000000, B00000000, B00000000, B0, 10,

only one LED in the bottom layer is lit

B00000011, B00000000, B00000000, B00000000, B0, 10,

will light 2 LEDs

B10101010, B00000000, B00000000, B00000000, B0, 10,

will light 4 of them in the bottom layer, alternating with the dark ones.

The next word does the same for the second layer

B10101010, B01010101, B00000000, B00000000, B0, 10,

will light the two bottom layers where the lit LEDS are above a dark one.

I hope you see the pattern now. The initial original program has 4 steps where the LEDS are ALL lit (all "1" in the B-words) and all off. So the program is operating correctly.

The last 5th number is the number of milliseconds the pattern will stay on. So changing the "10" to - say "1000" will leave that pattern on for one whole second.

B10101010, B01010101, B10101010, B01010101,  B1, 20,
B01010101, B10101010, B01010101, B10101010,  B1, 20,
B10101010, B01010101, B10101010, B01010101,  B1, 50,
B01010101, B10101010, B01010101, B10101010,  B1, 50,
B10101010, B01010101, B10101010, B01010101,  B1, 100,
B01010101, B10101010, B01010101, B10101010,  B1, 100,
B10101010, B01010101, B10101010, B01010101,  B1, 250,
B01010101, B10101010, B01010101, B10101010,  B1, 250,

This will do a checkerpattern blink sequence that slows down. The last line has to have "0" as the time. That causes the blink program to start from the beginning.

You can now write as long a blink program as you have seen in the video - there is room in an 328 for about 3500 of the above lines.

thank you for help and understanding and time…i really appreciate it.thanks…