Hello,
I've been trying to contact with Tom Igoe since he was the developer of this library but I couldn't find some email to write him. Therefore I think the apropiate place to post the bug is here.
I found an old avago 4 character display from a nortel modular router board so I decided to play a bit with it and arduino and it gave me a lot of fun.
What I found was that the library was originally writen for a 8 character display and (maybe) never tested against a 4 character display, until I tried it out to find it didnt work. Always showed blank display, and running some tests and debugs I found that the display worked if, instead using myDisplay.home(); used myDisplay.setCursor(4);.
I worked a couple of days with that little trick, until an idea crossed my mind like a bolt: the display was a shift register and the library allways sent a 40 lenght array without checking the display length; it was too much for a 20 needed display, so the display showed positions 4 to 7 instead 0 to 3 (20 to 39 instead 0 to 19).
Anyway, here is the patch that fixes this little issue:
--- LedDisplay_orig/LedDisplay.cpp 2009-04-17 22:12:49.000000000 +0200
+++ LedDisplay/LedDisplay.cpp 2009-10-06 18:05:14.000000000 +0200
@@ -250,12 +250,14 @@
// this method sends 320 bits to the dot register:
void LedDisplay::loadDotRegister() {
+ // define max data to send, patch for 4 length displays by KaR]V[aN
+ int maxData = displayLength * 5;
// select the dot register:
digitalWrite(registerSelect, LOW);
// enable writing to the display:
digitalWrite(chipEnable, LOW);
// shift the data out:
- for (int i = 0; i < 40; i++) {
+ for (int i = 0; i < maxData; i++) {
shiftOut(dataPin, clockPin, MSBFIRST, dotRegister[i]);
}
Hope to see it fixed soon.
Thanks for the effort, Arduino Community and keep up the good job!
PS: As the main arduino.cc page says about this library:
loadDotRegister() - sends 320 bits to the dot register
320 bits is for 8 character display, 4 character display *must* send 160 bits.