4x4x4 cube

hi, i typed this code on the ide then clicked the verify but it read at the bottom
'B0000B' was not declared in this scope

can someone guide me on this. i just copied the code from instructables.com
tnx. here it is
-- i just modified the 1st two lines

#include <avr/pgmspace.h>// allows use of PROGMEM to store patterns in flash

#define CUBESIZE 4
#define PLANESIZE CUBESIZE*CUBESIZE
#define PLANETIME 3333 //time each plane is displayed un us-> 100 Hz refresh
#define TIMECONST 20 // multiplies DisplayTime to get ms - why not =100?

//LED pattern table in PROGMEM - last column is displayed in 100ms units
prog_uchar PROGMEM PatternTable[] = {
// blink on and off

B1111,B0100,B0010,B0001,B1111,B0000,B0000,B0000,B1111,B0000,B0000,B0000,B1111,B0000B,B0000,B0000,10
B0000,B1111,B0010,B0001,B0000,B1111,B0000,B0000,B0000,B1111,B0000,B1111,B0000,B0000B,B1111,B0000,10
B1000,B0100,B0010,B0001,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000B,B0000,B0000,10
B1000,B0100,B0010,B0001,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000B,B0000,B0000,10
B1000,B0100,B0010,B0001,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000B,B0000,B0000,10
B1000,B0100,B0010,B0001,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000B,B0000,B0000,10
B1000,B0100,B0010,B0001,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000B,B0000,B0000,10
B1000,B0100,B0010,B0001,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000B,B0000,B0000,10
B1000,B0100,B0010,B0001,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000,B0000B,B0000,B0000,10 [/img]

Can you find "B0000B" anywhere in the text?

What can you see different in the 14th column of numbers?

Ya i see tnx
but again this message appears
expected ',' or ';' at end of input

help pls.

Where is it saying the error is at, what line? Post your full code, and put it in code tags. Look for the # in the tool bar above the smiley faces.

#include <avr/pgmspace.h>// allows use of PROGMEM to store patterns in flash

#define CUBESIZE 4
#define PLANESIZE CUBESIZE*CUBESIZE
#define PLANETIME 3333 //time each plane is displayed un us-> 100 Hz refresh
#define TIMECONST 20 // multiplies DisplayTime to get ms - why not =100?

//LED pattern table in PROGMEM - last column is displayed in 100ms units
prog_uchar PROGMEM PatternTable[] = {
// blink on and off

B1111,B0100,B0010,B0001,B1111,B0000,B0000,B0000,B1111,B0000,B0000,B0000,B1111,B0000,B0000,B0000,10,
B1111,B0100,B0010,B0001,B1111,B0000,B0000,B0000,B1111,B0000,B0000,B0000,B1111,B0000,B0000,B0000,10,
B1111,B0100,B0010,B0001,B1111,B0000,B0000,B0000,B1111,B0000,B0000,B0000,B1111,B0000,B0000,B0000,10,
B1111,B0100,B0010,B0001,B1111,B0000,B0000,B0000,B1111,B0000,B0000,B0000,B1111,B0000,B0000,B0000,10,

};

i affixed the ; after } as the first message suggests, i hit verify then it began compiling but after a few seconds the message read Error compiling

B1111,B0100,B0010,B0001,B1111,B0000,B0000,B0000,B1111,B0000,B0000,B0000,B1111,B0000,B0000,B0000,10,
B1111,B0100,B0010,B0001,B1111,B0000,B0000,B0000,B1111,B0000,B0000,B0000,B1111,B0000,B0000,B0000,10,
B1111,B0100,B0010,B0001,B1111,B0000,B0000,B0000,B1111,B0000,B0000,B0000,B1111,B0000,B0000,B0000,10,
B1111,B0100,B0010,B0001,B1111,B0000,B0000,B0000,B1111,B0000,B0000,B0000,B1111,B0000,B0000,B0000,10,

Take out this comma, and it should compile. If it doesn't copy the actual error, or take a screen shot and post it.

...still the same, aaah

If it doesn't copy the actual error, or take a screen shot and post it.

If this is your full code then I know exactly what the problem is.
Where is your void setup() and void loop() ? Every sketch needs to have them, no matter what. Unless, this is not a sketch, and it is a library.

Hi Dinky.

I have used that same code and it works well once you understand how to get it to do what you want. I do not know how you ended up with a copy of it with those "B"s at the end

'B0000B' was not declared in this scope

but I have attached a copy of this code that does compile so see how you go with it.
All the best Pedro.

#include <avr/pgmspace.h> // alHIGHs use of PROGMEM to store patterns in flash

#define CUBESIZE 4
#define PLANESIZE CUBESIZE*CUBESIZE
#define PLANETIME 3333 // time each plane is displayed in us -> 100 Hz refresh
#define TIMECONST 100 // multiplies DisplayTime to get ms - why not =100?

// LED Pattern Table in PROGMEM - last column is display time in 100ms units
// TODO this could be a lot more compact but not with binary pattern representation
prog_uchar PROGMEM PatternTable[] = {
// blink on and off
// Common anode, so we send plane pin high, and column pin low to light.


// 1= off, 0=on
// First group of each block is the right plane
// first 4 groups of 4 character blocks is bottom plane second is second layer, ...
// first character in segment is front plane


//Collumn spin Clockwise 360
B0111,B1011,B1101,B1110,B0111,B1011,B1101,B1110,B0111,B1011,B1101,B1110,B0111,B1011,B1101,B1110,01,
B1111,B0011,B1100,B1111,B1111,B0011,B1100,B1111,B1111,B0011,B1100,B1111,B1111,B0011,B1100,B1111,01,
B1111,B1100,B0011,B1111,B1111,B1100,B0011,B1111,B1111,B1100,B0011,B1111,B1111,B1100,B0011,B1111,01,
B1110,B1101,B1011,B0111,B1110,B1101,B1011,B0111,B1110,B1101,B1011,B0111,B1110,B1101,B1011,B0111,01,

B1101,B1101,B1011,B1011,B1101,B1101,B1011,B1011,B1101,B1101,B1011,B1011,B1101,B1101,B1011,B1011,01,
B1011,B1011,B1101,B1101,B1011,B1011,B1101,B1101,B1011,B1011,B1101,B1101,B1011,B1011,B1101,B1101,01,




// this is a dummy element for end of table (duration=0) aka !!!DO NOT TOUCH!!!
B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, B0000, 0
};

/*
** Defining pins in array makes it easier to rearrange how cube is wired
** Adjust numbers here until LEDs flash in order - L to R, T to B
** Note that analog inputs 0-5 are also digital outputs 14-19!
** Pin DigitalOut0 (serial RX) and AnalogIn5 are left open for future apps
*/

int LEDPin[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
int PlanePin[] = {11, 10, 9, 6};
int dataPin = 7; //Data  I added these for Shift Register
int clockPin = 12; // Clock 
int latchPin = 13; // Latch

// initialization
void setup()
{
int pin; // loop counter
// set up LED pins as output (active LOW)
//for (pin=0; pin<PLANESIZE; pin++) {
//  pinMode( LEDPin[pin], OUTPUT ); Edited out because we dont use them pins
// setup Shift Register pins instead of 16 arduino pins.
{
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
}
// set up plane pins as outputs (active HIGH)
for (pin=0; pin<CUBESIZE; pin++) {
pinMode( PlanePin[pin], OUTPUT );
}
}

// display pattern in table until DisplayTime is zero (then repeat)
void loop()
{
// declare variables
byte PatternBuf[PLANESIZE]; // saves current pattern from PatternTable
int PatternIdx;
byte DisplayTime; // time*100ms to display pattern
unsigned long EndTime;
int plane; // loop counter for cube refresh
int patbufidx; // indexes which byte from pattern buffer
int ledrow; // counts LEDs in refresh loop
int ledcol; // counts LEDs in refresh loop
int ledpin; // counts LEDs in refresh loop
int pinState;

// Initialize PatternIdx to beginning of pattern table
PatternIdx = 0;
// loop over entries in pattern table - while DisplayTime>0
do {
// read pattern from PROGMEM and save in array
memcpy_P( PatternBuf, PatternTable+PatternIdx, PLANESIZE );
PatternIdx += PLANESIZE;
// read DisplayTime from PROGMEM and increment index
DisplayTime = pgm_read_byte_near( PatternTable + PatternIdx++ );
// compute EndTime from current time (ms) and DisplayTime
EndTime = millis() + ((unsigned long) DisplayTime) * TIMECONST;

// loop while DisplayTime>0 and current time < EndTime
while ( millis() < EndTime ) {
patbufidx = 0; // reset index counter to beginning of buffer
// loop over planes
for (plane=0; plane<CUBESIZE; plane++) {
// turn previous plane off
if (plane==0) {
digitalWrite( PlanePin[CUBESIZE-1], LOW );
} else {
digitalWrite( PlanePin[plane-1], LOW );
}

// load current plane pattern data into ports
// Plane pins are taken care of above, this routine handles the 16
// LED pins(columns), originally 16 pins are now going to 2 shift registers
// using dataPin, clockPin, latchPin. 
// Original code
//ledpin = 0;
//for (ledrow=0; ledrow<CUBESIZE; ledrow++) {
//for (ledcol=0; ledcol<CUBESIZE; ledcol++) {
//digitalWrite( LEDPin[ledpin++], PatternBuf[patbufidx] & (1 << ledcol) );
//}
//patbufidx++;
//}

// I used code from shiftout, to redo this to serialize the plane data

    digitalWrite(latchPin, 0);
    //move 'em out
ledpin = 0;
for (ledrow=0; ledrow<CUBESIZE; ledrow++) {
for (ledcol=0; ledcol<CUBESIZE; ledcol++) {
  
 digitalWrite(clockPin, 0);
   
// digitalWrite( dataPin, PatternBuf[patbufidx] & (1 << ledcol) );
if (PatternBuf[patbufidx] & (1 << ledcol))
    {
      pinState= 1;  // Inverted for common anode
    }
    else
    {
      pinState= 0;  // Inverted for common anode
    }
 
    //Sets the pin to HIGH or LOW depending on pinState
    digitalWrite(dataPin, pinState); // this is where data is sent to the shift register.
    //register shifts bits on upstroke of clock pin
    digitalWrite(clockPin, 1);

ledpin++;
}
patbufidx++;
}
    digitalWrite(latchPin, 1);

// turn current plane on HIGH in my case of common anode.
digitalWrite( PlanePin[plane], HIGH );
// delay PLANETIME us
delayMicroseconds( PLANETIME );
} // for plane
} // while <EndTime
} while (DisplayTime > 0); // read patterns until time=0 which signals end
}

finally got it!
yah i just forgot to put the void setup and loop.
tnx a lot guys for your help. btw im from the phils 8)

hi,
do i stll have to declare all 20pins as outputs on the void setup?
the code that i copied didnt run on my cube. thre was no declaration of outputs
tnx

yes

hi to all

im a newbee but would like to see the code posted for the find code.

regards dudelove00