Multifunction LED matrix

My crude attempt at a multifunction display, 4 Sure Electronics 0X32 LED display's, DS1307 RTC, and DS1820 temp sensor. I hope to display song title from my jukebox, a PIII running DSL and XMMS, along with other info, just not there yet.

http://s307.photobucket.com/albums/nn284/webbyone/Lab%20stuff/

Nice.

Are you using someone's font library or did you do all that yourself?

yea, using the libraries here:

http://milesburton.com/index.php/HT1632_Arduino_"Matrix_Display"_Library_for_the_Sure_2416_and_0832

Is this library fully working also with the GREEN matrix???

Library

The DisplayMatrix library is designed to drive the RED Sure-Electronics 24x16 display (DE-DP016). This library makes it easy to cascade multiple displays so you can build really large panels for a reasonable price!

Mine is green, I don't think color make a difference.

Here is the code

#include "MatrixDisplay.h"
#include "DisplayToolbox.h"
#include "font.h"
#include <OneWire.h>
#include <DallasTemperature.h>
#include <stdlib.h>
#include <Wire.h>
#include "RTClib.h"

RTC_DS1307 RTC;

#define RTC5vPin 17 // pin 17 (analog pin 3) will be used to provide +5v to the RTC
#define RTCgndPin 16 // pin 18 (analog pin 2) will be used to provide GND to the RTC

#define DEMOTIME 30000  // 30 seconds max on each demo is enough.
#define DISPDELAY 100    // Each "display" lasts this long
#define LONGDELAY 1000  // This delay BETWEEN demos
#define ONE_WIRE_BUS 3

#define SCROLLSPEED 25 /// time in Miliseconds to wait between shifts
#define MAXSTRING 50

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

// Macro to make it the initDisplay function a little easier to understand
#define setMaster(dispNum, CSPin) initDisplay(dispNum,CSPin,true)
#define setSlave(dispNum, CSPin) initDisplay(dispNum,CSPin,false)

const byte nDisp = 4;//  Number of displays
const byte pinData = 9;// Data = 10/
const byte pinWR = 8;// WR == 11
const byte pinCS1 = 4; //
const byte pinCS2 = 5;
const byte pinCS3 = 6;
const byte pinCS4 = 7;

// Init Matrix
MatrixDisplay disp(nDisp,pinWR,pinData, true);
// Pass a copy of the display into the toolbox
DisplayToolbox toolbox(&disp);

// Prepare boundaries
uint8_t X_MAX = 0;
uint8_t Y_MAX = 0;

//setup banner
char banner[MAXSTRING];
int h,m,n,f,o,y;

void setup() {
  
  pinMode(RTC5vPin, OUTPUT);        // sets Pin for HIGH output
    digitalWrite(RTC5vPin, HIGH);     // turn pin on (5v) to power RTC
    pinMode(RTCgndPin, OUTPUT);       // sets Pin for output
    digitalWrite(RTCgndPin, LOW);     // turn pin on LOW (GND) to power RTC
 Wire.begin();
    RTC.begin();
  // Fetch bounds (dynamically work out how large this display is)
  X_MAX = disp.getDisplayCount() * (disp.getDisplayWidth()-1)+1;
  Y_MAX = disp.getDisplayHeight();

  // Prepare displays
  disp.setMaster(0,pinCS1);
  disp.setSlave(1,pinCS2);
  disp.setSlave(2,pinCS3);
 disp.setSlave(3,pinCS4);
sensors.begin();
}



void loop() {
  strcpy(banner,"webbys lab");

    scrollText();
    delay(100);
  DateTime now = RTC.now();
      sensors.requestTemperatures();
  // strcpy(banner,"temp is");

  //  scrollText();
  //  delay(100);
  
 n=sensors.getTempFByIndex(0);
 sprintf(banner,"temp %d f",n);
 

    scrollText();
    delay(100);
h= now.hour();

m=now.minute();

sprintf (banner,"time %d/%d",h,m);


 scrollText();
    delay(100);

f=now.day();
o=now.month();
y=now.year();

sprintf(banner,"%d/%d/%d",o,f,y);

scrollText();
delay(100);

    
}


/*
 * Copy a character glyph from the myfont data structure to
 * display memory, with its upper left at the given coordinate
 * This is unoptimized and simply uses setPixel() to draw each dot.
 */
void drawChar(uint8_t x, uint8_t y, char c)
{
  uint8_t dots;
  if (c >= 'A' && c <= 'Z' ||
    (c >= 'a' && c <= 'z') ) {
    c &= 0x1F;   // A-Z maps to 1-26
  }
  else if (c >= '0' && c <= '9') {
    c = (c - '0') + 27;
  }
  else if (c == ' ') {
    c = 0; // space
  }
  for (char col=0; col< 5; col++) {
    dots = pgm_read_byte_near(&myfont[c][col]);
    for (char row=0; row < 7; row++) {
	if (dots & (64>>row))   	     // only 7 rows.
	  toolbox.setPixel(x+col, y+row, 1);
	else
	  toolbox.setPixel(x+col, y+row, 0);
    }
  }
}


// Write out an entire string (Null terminated)
void drawString(uint8_t x, uint8_t y, char* c)
{
	for(char i=0; i< strlen(c); i++)
	{
		drawChar(x, y, c[i]);
		x+=6; // Width of each glyph
	}
}

void scrollText(){
  int x = X_MAX;
  int charsFinished = 0;
  char visible[11];		 //create visible array to hold string
  int i = 0;
  unsigned long lastUpdate = 0;   //variable used for scrolling function
  
  
  for (int n = 0; n < 11; n++){	//fill visible array with first char of string
    visible[n] = banner[n];
  }
  
  while(charsFinished < strlen(banner)){		  //while string still has characters
    if(millis() - lastUpdate > SCROLLSPEED){	  
	lastUpdate = millis();			    
	drawString(x, 0, visible);		     //draw visible array
	disp.syncDisplays();			    
	  
	x--;
	  
	if (x <= -6){				//after each character is finished  
	  charsFinished++;			 //advance one character
	  x = 0;
	  
	  i = 0;
	  while(i < 11 && banner[i + charsFinished] != '\0'){  
		visible[i] = banner[i + charsFinished];
		i++;
	  }
	  visible[i] = banner[i + charsFinished];	  
	}

	disp.clear();
    }
  }
}

Very nice, im wondering how i could input one of these LED matrix's with a message typed from a webpage, or stored on a certain url.
has anyone done this before?

Thanks

I have seen a few guys use it to display 'tweets' and mailbox stats, but they didn't show their process or code. I'm trying though.

This look promising for what i was doing, Only thing is a use different matrices from Holtek.

I have four together and they work but larger then this isn't working.
I will try this code provided above and see if this will work with the matrices.
Well done...