Sketch won't compie, ledcontrol.h error

I have compied and uploaded this sketch, but I wanted to make a couple of changes of options, which are possible in the sketch. After changing some options from 0 to 1 etc, the sketch would not compile. I undid the changes/options from 1 back to 0.
The sketch still won’t compile, and I have looked at then place were the error is but it is beyond my capabilites, when I don’t know what to do.

The sketch required some extra libraries which were not included in the download, so I got them from github

home/rob/sketchbook/libraries/LedControl/src/LedControl.h:42:7: error: expected unqualified-id before ‘static’
const static byte charTable PROGMEM = {
^
/home/rob/sketchbook/libraries/LedControl/src/LedControl.h:42:7: error: expected constructor, destructor, or type conversion before ‘static’

max7219_clock_Success.ino (43.6 KB)

LedControl.h (7.01 KB)

You need to read how to use the forum and post your code correctly and detail what was changed

hammy:
You need to read how to use the forum and post your code correctly and detail what was changed

I don't know what has changed, because I said what I had done then reversed it. That is all I know.
The problem is with the library file and not the sketch. I thought I said that in my OP

The sketch is almost 1600 lines lonhg and is far far too much to put in between code tags.

If you disagree, then I will try it, but it wouldn't work when I had a sketch 800 lines long.

There is a clue in the error message as to where your problem resides . Have a look at this .
I can’t really help but take heart..

It is a learning exercise, you need to know what the sketch is doing and understand the instructions and correct syntax, you could google the error message too.

Really better to start simple , be inspired by such sketches , but then write your own .

Oops...

**************************************************************
//Mini Clock v1.0, Jul 2014 by Nick Hall
//Distributed under the terms of the GPL.
//For help on how to build the clock see my blog:
//http://123led.wordpress.com/
//Tested on IDE v1.6.5
//small changes by Nicu FLORICA (niq_ro) - 14.12.2017, Craiova - Romania
//http://www.tehnic.go.ro
***********************************************************************

//include libraries:
#include "LedControl.h"

It seems I was missing a library file, which is now included in the sketch, and now I am getting a a load more errors now

home/rob/sketchbook/libraries/Matrix_clock_softi2c_cleaned/max7219.h: In function ‘void scrollLeft()’:
/home/rob/sketchbook/libraries/Matrix_clock_softi2c_cleaned/max7219.h:62:20: error: ‘NUM_MAX’ was not declared in this scope
for(int i=0; i < NUM_MAX*8+7; i++) scr = scr[i+1];

  • ^*
    /home/rob/sketchbook/libraries/Matrix_clock_softi2c_cleaned/max7219.h:62:38: error: ‘scr’ was not declared in this scope
    for(int i=0; i < NUM_MAX8+7; i++) scr = scr[i+1];
    _
    ^_
    /home/rob/sketchbook/libraries/Matrix_clock_softi2c_cleaned/max7219.h: In function ‘void invert()’:
    /home/rob/sketchbook/libraries/Matrix_clock_softi2c_cleaned/max7219.h:67:23: error: ‘NUM_MAX’ was not declared in this scope*

    for (int i = 0; i < NUM_MAX8; i++) scr _= ~scr;
    ^_

    /home/rob/sketchbook/libraries/Matrix_clock_softi2c_cleaned/max7219.h:67:39: error: ‘scr’ was not declared in this scope*

    for (int i = 0; i < NUM_MAX8; i++) scr _= ~scr;
    ^_

    /home/rob/sketchbook/libraries/Matrix_clock_softi2c_cleaned/max7219.h: In function ‘void initMAX7219()’:
    /home/rob/sketchbook/libraries/Matrix_clock_softi2c_cleaned/max7219.h:72:11: error: ‘DIN_PIN’ was not declared in this scope*

    * pinMode(DIN_PIN, OUTPUT);
    _ ^_
    /home/rob/sketchbook/libraries/Matrix_clock_softi2c_cleaned/max7219.h:73:11: error: ‘CLK_PIN’ was not declared in this scope*

    * pinMode(CLK_PIN, OUTPUT);
    _ ^_
    /home/rob/sketchbook/libraries/Matrix_clock_softi2c_cleaned/max7219.h:74:11: error: ‘CS_PIN’ was not declared in this scope*

    * pinMode(CS_PIN, OUTPUT);
    _ ^
    In file included from /home/rob/sketchbook/max7219_clock_Success/max7219_clock_Success.ino:18:0:
    /home/rob/sketchbook/libraries/LedControl/src/LedControl.h: At global scope:
    /home/rob/sketchbook/libraries/LedControl/src/LedControl.h:43:7: error: expected unqualified-id before ‘static’
    const static byte charTable [] PROGMEM = {
    ^
    /home/rob/sketchbook/libraries/LedControl/src/LedControl.h:43:7: error: expected constructor, destructor, or type conversion before ‘static’*

    Multiple libraries were found for “Wire.h”
    Used: /home/rob/.arduino15/packages/arduino/hardware/avr/1.6.21/libraries/Wire
    Not used: /home/rob/sketchbook/libraries/Wire_

My money is on a missing } or ; in your code. Somewhere in your code, not necessarily the line before/after.

The first is reasonably easy to find using the autoformat function of the IDE. The second is usually the line before where the IDE takes you.

wvmarle:
My money is on a missing } or ; in your code. Somewhere in your code, not necessarily the line before/after.

The first is reasonably easy to find using the autoformat function of the IDE. The second is usually the line before where the IDE takes you.

Thanks, and I’ve auto formatted the sketch, but still the same errors.

As an example would the missing } be in the ends of this part of sketch:

void setup() {

digitalWrite(2, HIGH); // turn on pullup resistor for button on pin 2
digitalWrite(3, HIGH); // turn on pullup resistor for button on pin 3
digitalWrite(4, HIGH); // turn on pullup resistor for button on pin 4

Serial.begin(9600); //start serial

//initialize the 4 matrix panels
//we have already set the number of devices when we created the LedControl
int devices = lc.getDeviceCount();
//we have to init all devices in a loop
for (int address = 0; address < devices; address++) {
/The MAX72XX is in power-saving mode on startup/
lc.shutdown(address, false);
/* Set the brightness to a medium values /
lc.setIntensity(address, intensity);
/
and clear the display */
lc.clearDisplay(address);
}

There is 2 open } and 1 closed (

Where would / should I put the closing }

Best guess: at the end of the function.

Basically: put it where it belongs. You're the programmer.

And please learn how to properly post code! After 187 posts you should know how to.

wvmarle:
Best guess: at the end of the function.

Basically: put it where it belongs. You're the programmer.

And please learn how to properly post code! After 187 posts you should know how to.

No, I am not a programmer and nor am I an EE. I wouldn't know what a functionh is if it hit me in the face.

Yes I do know how to post code, but the reason I didn't put it between code tages is because the actual sketch is over 9000 characters long and it is almost 1600 lines.

That is why I attached it im my OP.

Hi,
@oqibidipo in post #4 shows two errors for a start.

What model Arduino?

missing //

Tom.... :o

avalon66:
No, I am not a programmer and nor am I an EE. I wouldn't know what a functionh is if it hit me in the face.

Then do go and read some C++ tutorials, as otherwise you won't get anywhere. 1600 lines is a HUGE sketch, and you really have to know at least how a C++ program is put together or indeed you will get this kind of problems.

The function you posted does miss a } at the end - assuming that's really the end of the function.

Yes I do know how to post code, but the reason I didn't put it between code tages is because the actual sketch is over 9000 characters long and it is almost 1600 lines.

That is why I attached it im my OP.

I was referring to your post #7.

@wvmarle ,

fair comment then, my apologies.

A sample of the sketch which I think should have a closing brace }, but where do I put it.

void setup() {

  digitalWrite(2, HIGH);                 // turn on pullup resistor for button on pin 2
  digitalWrite(3, HIGH);                 // turn on pullup resistor for button on pin 3
  digitalWrite(4, HIGH);                 // turn on pullup resistor for button on pin 4

  Serial.begin(9600); //start serial

  //initialize the 4 matrix panels
  //we have already set the number of devices when we created the LedControl
  int devices = lc.getDeviceCount();
  //we have to init all devices in a loop
  for (int address = 0; address < devices; address++) {
    /*The MAX72XX is in power-saving mode on startup*/
    lc.shutdown(address, false);
    /* Set the brightness to a medium values */
    lc.setIntensity(address, intensity);
    /* and clear the display */
    lc.clearDisplay(address);
  }

TomGeorge:
Hi,
@oqibidipo in post #4 shows two errors for a start.

What model Arduino?

missing //

Tom… :o

I can see where there might be 1 error: include “LedControl.h”
I changed that to : include <LedControl.h> , but it didn’t make any difference.

I don’t see a 2nd error as there is only 1 line of the sketch in that post.

The Arduino is the UNO which I am using.

Thanks

The #include was correct.

Original:

**************************************************************
//Mini Clock v1.0, Jul 2014 by Nick Hall
//Distributed under the terms of the GPL.
//For help on how to build the clock see my blog:
//http://123led.wordpress.com/
//Tested on IDE v1.6.5
//small changes by Nicu FLORICA (niq_ro) - 14.12.2017, Craiova - Romania
//http://www.tehnic.go.ro
***********************************************************************

//include libraries:
#include "LedControl.h"

Without comments:

**************************************************************
***********************************************************************
#include "LedControl.h"

Hi,

**************************************************************
//Mini Clock v1.0, Jul 2014 by Nick Hall
//Distributed under the terms of the GPL.
//For help on how to build the clock see my blog:
//http://123led.wordpress.com/
//Tested on IDE v1.6.5
//small changes by Nicu FLORICA (niq_ro) - 14.12.2017, Craiova - Romania
//http://www.tehnic.go.ro
***********************************************************************

//include libraries:
#include "LedControl.h"

to;

//**************************************************************
//Mini Clock v1.0, Jul 2014 by Nick Hall
//Distributed under the terms of the GPL.
//For help on how to build the clock see my blog:
//http://123led.wordpress.com/
//Tested on IDE v1.6.5
//small changes by Nicu FLORICA (niq_ro) - 14.12.2017, Craiova - Romania
//http://www.tehnic.go.ro
//***********************************************************************

//include libraries:
#include "LedControl.h"

Will fix a few errors.
Tom... :slight_smile:

Thanks, but it did and it didn't, as I am now getting : 'Wire' does not name a type

A sample of the now error messages

/home/rob/sketchbook/libraries/Matrix_clock_softi2c_cleaned/max7219.h: In function 'void sendCmdAll(byte, byte)':
/home/rob/sketchbook/libraries/Matrix_clock_softi2c_cleaned/max7219.h:31:16: error: 'CS_PIN' was not declared in this scope
digitalWrite(CS_PIN, LOW);
^
/home/rob/sketchbook/libraries/Matrix_clock_softi2c_cleaned/max7219.h:32:16: error: 'NUM_MAX' was not declared in this scope
for (int i = NUM_MAX-1; i>=0; i--) {
^
/home/rob/sketchbook/libraries/Matrix_clock_softi2c_cleaned/max7219.h:33:14: error: 'DIN_PIN' was not declared in this scope
shiftOut(DIN_PIN, CLK_PIN, MSBFIRST, cmd);
^
/home/rob/sketchbook/libraries/Matrix_clock_softi2c_cleaned/max7219.h:33:23: error: 'CLK_PIN' was not declared in this scope
shiftOut(DIN_PIN, CLK_PIN, MSBFIRST, cmd);

oqibidipo:
The #include was correct.

Original:

**************************************************************

//Mini Clock v1.0, Jul 2014 by Nick Hall
//Distributed under the terms of the GPL.
//For help on how to build the clock see my blog:
//http://123led.wordpress.com/
//Tested on IDE v1.6.5
//small changes by Nicu FLORICA (niq_ro) - 14.12.2017, Craiova - Romania
//http://www.tehnic.go.ro


//include libraries:
#include "LedControl.h"




Without comments:





#include "LedControl.h"

Thanks that has been changed now to // in front of the 2 said lines