Pages: [1]   Go Down
Author Topic: Library Errors in Arduino CookBook 2e - 8X8 array and Max7221  (Read 918 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I a trying to run the sketch 7.13 from the book for playing with an 8x8 array.  This was a clear example of wiring.  Code below.

Code:
/*
 * Hello Matrix
 * by Nicholas Zambetti <http://www.zambetti.com>
 * Demonstrates the use of the Matrix library
 * For MAX7219 LED Matrix Controllers
 * Blinks welcoming face on screen
 */    
 
// the following two libraries are not provided with the 1.0 distribution
// see the text for links to the download
#include <Sprite.h>  
#include <Matrix.h>

const int loadPin  = 2;
const int clockPin = 3;
const int dataPin  = 4;

Matrix myMatrix = Matrix(dataPin, clockPin, loadPin); // create Matrix instance

void setup()
{
}

void loop()
{
  myMatrix.clear(); // clear display

  delay(1000);

  // turn some pixels on
  myMatrix.write(1, 5, HIGH);
  myMatrix.write(2, 2, HIGH);
  myMatrix.write(2, 6, HIGH);
  myMatrix.write(3, 6, HIGH);
  myMatrix.write(4, 6, HIGH);
  myMatrix.write(5, 2, HIGH);
  myMatrix.write(5, 6, HIGH);
  myMatrix.write(6, 5, HIGH);

  delay(1000);
}
      

I am getting the following errors....  I pulled the libraries from version 022 as they are not able to be located after searching the Arduino site.  Now it looks like I need the wConstants.h library???? Is this correct.  Anyone know where I can find it?  Suggestions?

C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\libraries\Matrix\Matrix.cpp:34:26: error: WConstants.h: No such file or directory
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\libraries\Matrix\Matrix.cpp: In constructor 'Matrix::Matrix(uint8_t, uint8_t, uint8_t, uint8_t)':
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\libraries\Matrix\Matrix.cpp:76: error: 'OUTPUT' was not declared in this scope
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\libraries\Matrix\Matrix.cpp:76: error: 'pinMode' was not declared in this scope
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\libraries\Matrix\Matrix.cpp: In member function 'void Matrix::putByte(uint8_t)':
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\libraries\Matrix\Matrix.cpp:105: error: 'LOW' was not declared in this scope
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\libraries\Matrix\Matrix.cpp:105: error: 'digitalWrite' was not declared in this scope
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\libraries\Matrix\Matrix.cpp:107: error: 'HIGH' was not declared in this scope
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\libraries\Matrix\Matrix.cpp:111: error: 'HIGH' was not declared in this scope
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\libraries\Matrix\Matrix.cpp: In member function 'void Matrix::setRegister(uint8_t, uint8_t)':
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\libraries\Matrix\Matrix.cpp:119: error: 'LOW' was not declared in this scope
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\libraries\Matrix\Matrix.cpp:119: error: 'digitalWrite' was not declared in this scope
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\libraries\Matrix\Matrix.cpp:124: error: 'HIGH' was not declared in this scope
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\libraries\Matrix\Matrix.cpp: In member function 'void Matrix::syncRow(uint8_t)':
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\libraries\Matrix\Matrix.cpp:135: error: 'LOW' was not declared in this scope
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\libraries\Matrix\Matrix.cpp:135: error: 'digitalWrite' was not declared in this scope
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\libraries\Matrix\Matrix.cpp:140: error: 'HIGH' was not declared in this scope
[/size]
« Last Edit: July 26, 2012, 05:10:42 pm by danielNC » Logged

Ayer, Massachusetts, USA
Offline Offline
Edison Member
*
Karma: 54
Posts: 1857
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I am getting the following errors....  I pulled the libraries from version 022 as they are not able to be located after searching the Arduino site.  Now it looks like I need the wConstants.h library???? Is this correct.  Anyone know where I can find it?  Suggestions?
You might try reading the second section in the "Read This before posting a programming question..." that is pinned to be the first post.  (hint, WConstants.h and WProgram.h were removed in IDE 1.0, replaced by Arduino.h).
« Last Edit: July 26, 2012, 05:59:35 pm by MichaelMeissner » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

From what I gather, the constants.h file was renamed to Arduino.h

I made this change in the matrix.cpp file but I now get a whole host of other errors.  See below.  I did notice the Backslash became a forwardslash when I changed the matrix.cpp file.

Please help!


In file included from C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\hardware\arduino\cores\arduino/Arduino.h:192,
                 from C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\libraries\Matrix\Matrix.cpp:34:
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\hardware\arduino\cores\arduino/WString.h:116: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, const char*)' conflicts with
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\hardware\arduino\cores\arduino/WString.h:115: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, const String&)' here
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\hardware\arduino\cores\arduino/WString.h:117: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, char)' conflicts with
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\hardware\arduino\cores\arduino/WString.h:116: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, const char*)' here
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\hardware\arduino\cores\arduino/WString.h:118: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, unsigned char)' conflicts with
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\hardware\arduino\cores\arduino/WString.h:117: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, char)' here
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\hardware\arduino\cores\arduino/WString.h:119: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, int)' conflicts with
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\hardware\arduino\cores\arduino/WString.h:118: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, unsigned char)' here
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\hardware\arduino\cores\arduino/WString.h:120: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, unsigned int)' conflicts with
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\hardware\arduino\cores\arduino/WString.h:119: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, int)' here
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\hardware\arduino\cores\arduino/WString.h:121: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, long int)' conflicts with
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\hardware\arduino\cores\arduino/WString.h:120: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, unsigned int)' here
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\hardware\arduino\cores\arduino/WString.h:122: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, long unsigned int)' conflicts with
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\hardware\arduino\cores\arduino/WString.h:121: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, long int)' here
In file included from C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\libraries\Matrix\Matrix.cpp:34:
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\hardware\arduino\cores\arduino/Arduino.h:196: error: declaration of C function 'uint16_t makeWord(byte, byte)' conflicts with
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\hardware\arduino\cores\arduino/Arduino.h:195: error: previous declaration 'uint16_t makeWord(uint16_t)' here
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\hardware\arduino\cores\arduino/Arduino.h:206: error: declaration of C function 'long int random(long int)' conflicts with
c:/documents and settings/daniel/my documents/dropbox/alich/arduino-1.0/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:504: error: previous declaration 'long int random()' here
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\hardware\arduino\cores\arduino/Arduino.h:207: error: declaration of C function 'long int random(long int, long int)' conflicts with
C:\Documents and Settings\Daniel\My Documents\Dropbox\Alich\arduino-1.0\hardware\arduino\cores\arduino/Arduino.h:206: error: previous declaration 'long int random(long int)' here
Logged

Ayer, Massachusetts, USA
Offline Offline
Edison Member
*
Karma: 54
Posts: 1857
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

At a guess then, you either have to track down a newer version of the library that works with the 1.0 IDE, or you have to switch to the older IDE.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Getting frustrated with DIY electronics.

Tried loading the code in ver022 and it appease to load fine, however no luck getting any sort of intelligent result from LED array.

Is anyone able to get a result from this wiring?  If you happen to have some sample code I would appreciate it.

http://my.safaribooksonline.com/book/hardware/arduino/9781449321185/7dot13dot-controlling-an-array-of-leds-by-using-max72xx-shift-registers/id3960284

Thank you in advance,
Dan
Logged

Offline Offline
Edison Member
*
Karma: 19
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I haven't run this code in a while, but I think it should still work:

https://github.com/WizenedEE/arduino/blob/master/LEDMatrix/LEDMatrix0/MAX7219/withoutLibrary/withoutLibrary.pde

(change the pin numbers as appropriate)

You could also try out the library I wrote:

https://github.com/WizenedEE/arduino/tree/master/libraries/LEDArray

The example *should* work but no guarantees
Logged

Norfolk UK
Offline Offline
Faraday Member
**
Karma: 70
Posts: 2592
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I used the LedControl library on Arduino v1.0 as it suited my needs better (No need of sprites) http://arduino.cc/playground/Main/LedControl
Logged


Pages: [1]   Go Up
Jump to: