Freetronics DMD Library Porting Struggles

Thanks @peekay123, I really appreciate the effort you and @archimag0 put into getting this panel working with the Spark/Photon device. Currently it’s on my roof under a gable, in a 2x1 configuration with Christmas messages and some cheesy pixel art running through in a loop. Ahh the kids love it :smile:

2 Likes

I know this was some time ago but I am trying to get my Freetronics DMD working with an electron. When attempting to flash the dmd-demo.ino file I receive the following error:

In file included from lib/DMD/src/DMD.cpp:26:0:
lib/DMD/src/DMD.h:45:2: warning: #warning CHANGE THESE TO SEMI-ADJUSTABLE PIN DEFS! [-Wcpp]
 #warning CHANGE THESE TO SEMI-ADJUSTABLE PIN DEFS!
  ^
lib/DMD/src/DMD.cpp: In constructor 'DMD::DMD(byte, byte)':
lib/DMD/src/DMD.cpp:35:14: warning: unused variable 'ui' [-Wunused-variable]
     uint16_t ui;
          ^
lib/DMD/src/DMD.cpp: In member function 'void DMD::drawTestPattern(byte)':
lib/DMD/src/DMD.cpp:388:23: warning: comparison between signed and unsigned integer expressions [-Wsign-
compare]
 for (ui = 0; ui < numPixels; ui++) {
                   ^
lib/DMD/src/DMD.cpp: In member function 'int DMD::charWidth(char)':
lib/DMD/src/DMD.cpp:534:14: warning: unused variable 'index' [-Wunused-variable]
     uint16_t index = 0;
          ^
lib/SparkIntervalTimer/examples/SparkIntervalTimerDemo/SparkIntervalTimerDemo.cpp:14:32: fatal error: SparkIntervalTimer.h: No such file or directory
 #include "SparkIntervalTimer.h"
                            ^
compilation terminated.
make[1]: *** [../build/target/user/platform-
10lib/SparkIntervalTimer/examples/SparkIntervalTimerDemo/SparkIntervalTimerDemo.o] Error 1
make: *** [user] Error 2

Might somebody be able to guide me with this?
It is worth noting that I am doing this all through the online IDE using the ‘DMD’ library, perhaps that is different to this one?

@mortonc, how are you compiling the code - web IDE, CLI, Particle IDE? The error indicates that it can’t find the SparkIntervalTimer library so you most likely need to attach it to your project.

@peekay123 I am compiling via the web IDE. You were right I hadn’t attached the SparkIntervalTimer library to my project but I have done that now and it is still showing the same error message.

What system firmware version are you targeting? It needs to be 0.5.3 or later

1 Like

Ah really? I am on 4.8 (using a 2G Electron). On the GitHub page it says firmware 4.5 or later is required.

The problem with that statement is that it doesn't take into account that there was a change in library management on the Particle side.
While the library code has stayed unchanged and hence the repo is still valid, Particle has auto-migrated the published library to fit their v2.0 library structure but then the #include statements don't fit anymore.
If you want to stick with an old system version you also need to select the original (pre-migration) library.

But why stick with an outdated system anyway?

Ok well that sounds like that might be the answer, thank you! I only just got hold of this 2G version and was too hasty to get playing, I shall upgrade now!

@ScruffR, I believe @mortonc is using the library I ported which I converted to V2.0 last year. Perhaps I should change that notice to say v5.3 or later.

1 Like

Thank you both, having updated the firmware I can now control the display.

A problem I am getting though is when using the following code, whatever string I enter it always displays a “0” after it e.g “FR” displays as “FR0” and “10” displays as “100”. Any thoughts on what might be causing that?

/*--------------------------------------------------------------------------------------
  Includes
--------------------------------------------------------------------------------------*/
//#include <SPI.h>        //SPI.h must be included as DMD is written by SPI (the IDE complains otherwise)
#include "DMD.h"        //
#include "SystemFont5x7.h"
#include "Arial_black_16.h"
#include "SparkIntervalTimer.h"

//Fire up the DMD library as dmd
#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 1
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);

IntervalTimer scanTimer;

/*--------------------------------------------------------------------------------------
  Interrupt handler for Timer1 (TimerOne) driven DMD refresh scanning, this gets
  called at the period set in Timer1.initialize();
--------------------------------------------------------------------------------------*/
void ScanDMD()
{ 
  dmd.scanDisplayBySPI();
}

/*--------------------------------------------------------------------------------------
  setup
  Called by the Arduino architecture before the main loop begins
--------------------------------------------------------------------------------------*/
void setup(void)
{

	scanTimer.begin(ScanDMD, 5000, uSec);

   //initialize TimerOne's interrupt/CPU usage used to scan and refresh the display
//   Timer1.initialize( 5000 );           //period in microseconds to call ScanDMD. Anything longer than 5000 (5ms) and you can see flicker.
//   Timer1.attachInterrupt( ScanDMD );   //attach the Timer1 interrupt to ScanDMD which goes to dmd.scanDisplayBySPI()

   //clear/init the DMD pixels held in RAM
   dmd.clearScreen( true );   //true is normal (all pixels off), false is negative (all pixels on)

}

/*--------------------------------------------------------------------------------------
  loop
  Arduino architecture main loop
--------------------------------------------------------------------------------------*/
void loop(void)
{
  // byte b;
   
  
  // display some text
   dmd.clearScreen( true );
   dmd.selectFont(Arial_Black_16);

   for (byte x=0;x<DISPLAYS_ACROSS;x++) {
     for (byte y=0;y<DISPLAYS_DOWN;y++) {
       dmd.drawString(  2+(32*x),  1+(16*y), "ab", 5, GRAPHICS_NORMAL );
     }
   }
    
   
   delay( 2000 );
   
   
}

Don’t worry I just realised I still had the string length set to 5!! Doh

3 Likes