Issue Compiling Code from Miles Burton Matrix Library

I'm using Arduino 1.0.5 on a Mac running OSX 10.8.4. I recently purchased a couple Sure Electronics 0832 LED matrices and I was hoping to use my Arduino Uno to control them. I installed the libraries into the Arduino software, but when I try to compile some of the example software, I get a lot of errors. For instance, this is what I see when I try to compile Simple:

MatrixDisplay.cpp: In constructor 'MatrixDisplay::MatrixDisplay(uint8_t, uint8_t, uint8_t, bool)':
MatrixDisplay.cpp:83: error: 'OUTPUT' was not declared in this scope
MatrixDisplay.cpp:83: error: 'pinMode' was not declared in this scope
MatrixDisplay.cpp: In member function 'void MatrixDisplay::initDisplay(uint8_t, uint8_t, bool)':
MatrixDisplay.cpp:121: error: 'OUTPUT' was not declared in this scope
MatrixDisplay.cpp:121: error: 'pinMode' was not declared in this scope

I've searched the web and I can't find any advice so far that has worked to help remedy this issue. Thanks for the help!

Can you post a link to the lib?

I think it is not upgraded to support 1.0 and higher, so some header thingies need to be fixed.

Here is the library info/download page. He mentions that you should use Arduino 0017 or 0018. I tried both of these versions and I still get errors during compiling.

Thanks!

In case you were wondering where your duplicate of this topic was, I've deleted it to save people wasting their time. DO NOT CROSS-POST.

I cannot believe how hard it is to get this message across.

The main site to get the latest library from is here. Not sure if it’s updated for newer Arduino IDE but I would expect so as it’s dated June 2012.
Failing that I have attached the library and sketch I have to test the modules.

HT1632.zip (14.1 KB)

Sure3208_Test.ino (1.23 KB)

I changed MatrixDisplay.h to support 1.00 and up and the example code simple.pde (renamed to .ino) compiled.
Cannot test it as I have no such device.

#ifndef MATRIX_DISPLAY_GUARD
#define MATRIX_DISPLAY_GUARD

#if ARDUINO < 100
#include <WProgram.h>
#include <wiring.h>
#else
#include <Arduino.h>
#endif

#include <inttypes.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

#include "HardwareSerial.h"

Give it a try:

And in support of AWOL:
Some negative effects of crossposting
1: People cannot react on each others post and this reduces the chance on a solution.
2: For you it takes more time as you need to merge comments of the different threads manually
3: If in the future someone finds these separate threads it is less useful for her/him too

posted an issue to patch the lib - https://github.com/milesburton/HT1632/issues/1 -

That worked! Thanks a ton for the quick replies. Sorry about the cross-post. Those points definitely make sense. I’m used to far less efficient forums. I have one last question about this library. I have the Green matrix, and this library was written for the Red matrix. On his site, he lists a patch to alter the code:

--- MatrixDisplay_201/MatrixDisplay.cpp	2010-03-22 17:17:34.000000000 +0100
+++ MatrixDisplay_201_mio/MatrixDisplay.cpp	2011-02-09 16:46:11.688636952 +0100
@@ -49,6 +49,10 @@ PORTC &= ~(1 << (_pin -14) ))
 
 #define DIRTY_BIT           0x80
 
+//if you want to use a green display(de-dp016)
+#define GREENDISPLAY
+
+
 
 ///////////////////////////////////////////////////////////////////////////////
 //  CTORS & DTOR
@@ -331,15 +335,36 @@ inline uint8_t MatrixDisplay::xyToIndex(
     y &= 0xF;
 	
 	
-	uint8_t addresss = y > 7 ? 1 : 0; // Work out which panel it's on (top:0, bottom:1)
-    addresss += x<<1; // Shift x by 1 and add which panel it's on
+
+
+
+     
+#ifdef GREENDISPLAY      
+     uint8_t addresss = y > 7 ? 1 : 0;
+     addresss += (x<<1)^14;
+#else
+     uint8_t addresss = y > 7 ? 1 : 0; // Work out which panel it's on (top:0, bottom:1)
+   addresss += x<<1; // Shift x by 1 and add which panel it's on
+#endif
+
     return addresss;
 }
 
 inline uint8_t MatrixDisplay::displayXYToIndex(uint8_t x, uint8_t y)
 {
-	uint8_t addresss = y == 0 ? 0 : (y / 4); // Calculate which quandrant[?] it's in 
-	addresss += x << 2; // Shift x by 2 and add which panel it's on
+     
+#ifdef GREENDISPLAY      
+     //new code
+     // actual formula for finding display memory adress from the X,Y  
+     uint8_t addresss = ((x<<2)^28);
+     addresss  += y<4   ? 1 : 0;
+     addresss  += y>11  ? 1 : 0;
+   addresss  += 7< y >12   ? 1 : 0;
+#else
+           uint8_t addresss = y == 0 ? 0 : (y / 4); // Calculate which quandrant[?] it's in
+           addresss += x << 2; // Shift x by 2 and add which panel it's on
+#endif
+
 	return addresss;
 }
 
@@ -493,4 +518,4 @@ void MatrixDisplay::setBrightness(uint8_
 	preCommand();
 	writeDataBE(8,HT1632_CMD_PWM+pwmValue,true);
 	releaseDisplay(dispNum);
-}
\ No hay ningún carácter de nueva línea al final del fichero
+}
</pre.

I was wondering how to insert that into the existing code. Thanks again.

  • are lines removed
  • are lines added (replaces the - lines)

there are line numbers mentioned - note that patches refer to a specific version of the code ..