I got a sketch from the internet (http://www.instructables.com/id/How-to-build-an-8x8x8-LED-cube-and-control-it-with/) for controlling the display of an 8x8x8 LED cube. The program won't compile and the error says "stray '#' in program". I looked it up on google but nothing appears to be relevant. Here's a part of the code. (The error occurs at the baseColor = color(#222222); line)

int rectX, rectY;      // Position of square button
int rectSizeX = 80;     // Width of rect
int rectSizeY = 20;     // Height of rect
int circleSize = 20;   // Diameter of circle
color rectColor, circleColorOff, circleColorOn, baseColor;
color rectHighlight, circleHighlight;
color circleCurrentColor;
color rectCurrentColor;
boolean rectOver = false;

// State of LEDs
boolean[][] circleOn;

// Position of LED buttons
int[][] circlePos;

// Mouse Over LED buttons?
boolean [][] circleOver;

int delayedby = 50;

void setup() {
 //number of rows and columns
 ROWX= 8;
 ROWY= 8;

 size((ROWX*40+10), (ROWY*44+30));
 rectX = ROWX*20-30;
 rectY = ROWY*44+5;
 // Colors
 rectColor = color(#FF0000);
 rectHighlight = color(#FFFF00);
 circleColorOff = color(#444444);
 circleColorOn = color(#ff0000);
 circleHighlight = color(#CCFF00);
 baseColor = color(#222222);
 circleCurrentColor = circleColorOff;
 rectCurrentColor = rectColor;

circleOn = new boolean[ROWX][ROWY];
for(int i=0; i<=(ROWY-1); i++) {
 for(int j=0; j<=(ROWX-1); j++) {
   circleOn[j][i] = false;
circlePos = new int[2][(ROWX*ROWY+1)];

// X Posistions
for(int i=0; i<(ROWX*ROWY-(ROWX-1)); i=i+ROWX) {
int Xpos = 25;
  for(int ii=0; ii<ROWX; ii++) {
     circlePos[0][i+ii] = Xpos;
     Xpos += 40;

// Y Positions
int Ypos = 40;
 for(int i=0; i<(ROWX*ROWY-(ROWX-1)); i+=ROWX) {
  for(int ii=0; ii<ROWX; ii++) {
     circlePos[1][i+ii] = Ypos;
        Ypos += 40;

circleOver = new boolean[ROWX][ROWY];
for(int i=0; i<=(ROWY-1); i++) {
 for(int j=0; j<=(ROWX-1); j++) {
   circleOver[j][i] = false;

It turns out that the code was compiled in the earlier beta versions of the Arduino IDE, and now I don't know what I need to do for it to be compiled by my 1.6.5 version.

  • 2
    That is not C/C++ syntax. Replace # with 0x (to start with). Then you will have to reduce the size of the data structures. Check the sizeof(boolean). Mar 12, 2016 at 10:27
  • I think this code is obsolete. I'm getting new errors like non existent data types and other syntax errors
    – DorkOrc
    Mar 12, 2016 at 10:42
  • 1
    Some of that looks more like java than C to me...
    – Majenko
    Mar 12, 2016 at 11:11
  • 3
    The code you have posted is a processing file, you haven't posted all the code and stated that its processing related, leaving it to the community to figure this out. This is more suited to stackoverflow or the Processing IDE
    – RSM
    Mar 12, 2016 at 16:53

1 Answer 1


From the Instructable you linked:

matrix8x8.pde is a program in Processing to build your own displays.

You downloaded the Processing code, not the Arduino code. See above that:

cube8x8x8.pde is the Arduino code.

So basically you are compiling the wrong code. Go back and re-read that page.

Not the answer you're looking for? Browse other questions tagged or ask your own question.