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.
/*
* 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]
danielNC:
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).
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