New beta release "DMD2" Library

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
xavier.seignard
Posts: 2
Joined: Tue Jul 22, 2014 10:18 am

Re: New beta release "DMD2" Library

Post by xavier.seignard » Wed Aug 13, 2014 11:35 am

Hi Angus,

Is scrolling and variable speed scrolling planned?

Any ETA for that?

I've a show in november with 20 DMDs to prepare and variable speed scrolling is the functionality we need, so it would be great to see that feature in the lib.

But when I look at DMD1 example here: https://github.com/freetronics/DMD/blob ... #L104-L113

It seems it's doable by adjusting the following timing condition

Code: Select all

if ((timer+30) < millis())
Am I right?

Regards

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: New beta release "DMD2" Library

Post by angusgr » Wed Aug 13, 2014 10:15 pm

xavier.seignard wrote:Hi Angus,

Is scrolling and variable speed scrolling planned?

Any ETA for that?

I've a show in november with 20 DMDs to prepare and variable speed scrolling is the functionality we need, so it would be great to see that feature in the lib.

But when I look at DMD1 example here: https://github.com/freetronics/DMD/blob ... #L104-L113

It seems it's doable by adjusting the following timing condition

Code: Select all

if ((timer+30) < millis())
Am I right?

Regards
Hi Xavier,

That will effect the speed of the "marquee" scrolling, which is horizontally moving text. If that's what you want then changing the '30' in that code will work.

I do plan to add marquee scrolling to DMD2, but there's not ETA for that yet - if you want that kind of scrolling I'd suggest using the original DMD library for now.

If you want variable speed vertical scrolling, at the moment the only way to scroll is line-by-line. You can probably effect the speed of that in DMD2, but there's no per-pixel vertical scrolling supported (or planned), unfortunately.


Angus

Binkles
Posts: 10
Joined: Mon Jul 14, 2014 1:09 pm

Re: New beta release "DMD2" Library

Post by Binkles » Mon Aug 25, 2014 4:16 am

Ok call me dumb, you wouldn't be the first, nor the last.

I've got a number - lets say 1234, but I want to show it as 1.234 using dmd2.

I've tried this to no eval (the number comes in as an int..

Code: Select all

void displayTime(int lane, long LapTime){
int x_pos;
int y_pos;
float floattime ;

  floattime = LapTime / 1000;
char DisplayLapTime [10];

  switch (lane){
    case 0:
      x_pos=0;
      y_pos=0;
      break;
    case 1:
      x_pos=0;
      y_pos=8;
      break;
    case 2:
      x_pos=32;
      y_pos=0;
      break;
    case 3:
      x_pos=32;
      y_pos=8;
      break;
  }
dtostrf(floattime,2,3,DisplayLapTime);
  dmd.drawString(x_pos,y_pos,DisplayLapTime);
What it displays is 1.000.

Help?

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: New beta release "DMD2" Library

Post by angusgr » Wed Aug 27, 2014 4:30 am

Hi Binkles,

The catch is to do with the way the C/C++ programming language interprets this statement:

Code: Select all

floattime = LapTime / 1000
floattime is a float, and LapTime is a long integer. And the statement seems to read "set the float value floattime to LapTime / 1000". But how it is exactly evaluated is "Divide integer LapTime by 1000" then "assign result to floattime". And the result of the first calculation is the integer 1!

If you change it to this:

Code: Select all

floattime = LapTime / 1000.0
Then the code will work. Why does this work but not the first way? 1000 is an integer constant so the result of division is an integer, but 1000.0 is a floating point constant so the result of the division is a floating point number.

As a possible suggestion, instead of floating point you can also do this:

Code: Select all

snprintf(DisplayLapTime, 10, "%d.%d", LapTime/1000, LapTime%1000);
This simulates the floating point result using an integer divide and a modulo operation. It's (possibly) more lightweight, although sprintf might be a bit heavy too. You'd have to check both ways to be sure.


Angus

victorhooi
Posts: 16
Joined: Thu Mar 06, 2014 4:00 pm

Re: New beta release "DMD2" Library

Post by victorhooi » Thu Sep 11, 2014 12:17 pm

Hi,

Would it be possible to add a shorter version of Droid Sans to DMD2?

Currently, I'm using the included Droid_Sans_12 font. However, this uses 9 pixels for the vertical height.

The DMD2 has 16 vertical pixels, so this leaves 7 pixels if you want a second row of text, which isn't enough.

It would be great if there was a Droid Sans font that was say, 8 pixels vertically, which would let you fit in 2 lines of text at once. (Even 7 would be nice, although I don't know if the characters would be too cramped).

Secondly, can you tell me what the difference between dmd.drawString(), versus the DMD_TextBox object and print()? As in, when would you use one versus the other?

Thirdly, what does the F in the below mean?

Code: Select all

box.println(F(" . . ."));
Fourthly, if I'm doing a countdown clock, and I want to clear it each time, how do I stop the flickering effect between each refresh? For example, if my loop looks something like this:

Code: Select all

upper_box.print(time);
delay(1000);
upper_box.clear();
It flickers each second, I assume when it goes to clear it, and before it prints the next time?

Fifth, how do you control/stop the scrolling? It seems if I don't clear the DMD_TextBox, it does some kind of scrolling? Can you just have it print over the top?

Regards,
Victor

victorhooi
Posts: 16
Joined: Thu Mar 06, 2014 4:00 pm

Re: New beta release "DMD2" Library

Post by victorhooi » Thu Sep 11, 2014 9:08 pm

Hi,

I've noticed something strange - when I use dmd.begin() in my sketch, it seems to cause the time I get from the RTC module (using DS3232RTC.h) to go all over the place - more details here:

viewtopic.php?f=15&t=6051&p=13202#p13202

Has anybody tried using the RTC module and DMD module at the same time?

Were you able to get them working together successfully?

Any thoughts on what I might be able to do in my case?

Cheers,
Victor

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: New beta release "DMD2" Library

Post by angusgr » Fri Sep 12, 2014 4:25 am

victorhooi wrote:Hi,

Would it be possible to add a shorter version of Droid Sans to DMD2?

Currently, I'm using the included Droid_Sans_12 font. However, this uses 9 pixels for the vertical height.

The DMD2 has 16 vertical pixels, so this leaves 7 pixels if you want a second row of text, which isn't enough.

It would be great if there was a Droid Sans font that was say, 8 pixels vertically, which would let you fit in 2 lines of text at once. (Even 7 would be nice, although I don't know if the characters would be too cramped).
Great suggestion, thanks. Many of those fonts that came much higher-res FTOLED library, so it makes sense to create some more specific sizes.
victorhooi wrote: Secondly, can you tell me what the difference between dmd.drawString(), versus the DMD_TextBox object and print()? As in, when would you use one versus the other?
The TextBox manages scrolling automatically, whereas drawString() just outputs the string at the specified position.
victorhooi wrote: Thirdly, what does the F in the below mean?

Code: Select all

box.println(F(" . . ."));
The "F" macro tells the Arduino compiler that you want to store the string constant in flash, rather than in RAM. This is useful because the Atmega328p in the Uno/Eleven has 32K of flash but only 2K of RAM.
victorhooi wrote: Fourthly, if I'm doing a countdown clock, and I want to clear it each time, how do I stop the flickering effect between each refresh? For example, if my loop looks something like this:

Code: Select all

upper_box.print(time);
delay(1000);
upper_box.clear();
It flickers each second, I assume when it goes to clear it, and before it prints the next time?

Fifth, how do you control/stop the scrolling? It seems if I don't clear the DMD_TextBox, it does some kind of scrolling? Can you just have it print over the top?
There are two techniques you can do here.

One is to just use dmd.drawString() to draw in the same place each time. If you add a couple of space characters " " at the end of the string then it will always completely over-write what was there before. This is probably what I'd recommend.

The other is to use upper_box.reset() instead of upper_box.clear(). Calling reset() moves the cursor back to the beginning of the box, without clearing the contents. That way you can write over the top of what you previously output, without ever displaying a "clear" screen. If you go this route, then use 'println' instead of print for your output line (this ensures previous columns are cleared all the way to the end of the line).

Hope that helps answer your questions.


Angus

Hobohome
Posts: 9
Joined: Sat Dec 21, 2013 12:39 am

Re: New beta release "DMD2" Library

Post by Hobohome » Sat Nov 29, 2014 6:52 am

I'm just trying to get the DMD working with an EtherTen (and the DMD2 lib).
Everything works just fine until I issue a Ethernet.begin - at this point the display shows random blocks.
Can anybody tell me if this lib is compatible with the EtherTen ?

Thanks

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: New beta release "DMD2" Library

Post by angusgr » Mon Dec 01, 2014 9:55 pm

Hi Hobohome,

The display is potentially compatible, but because by default they both use the SPI pins on the Arduino then it can be tricky to get them to play well together.

The simplest solution is actually to rewire the DMD not to use the 10,11,12,13 pins and instead use any other pins. Then use the SoftDMD feature in DMD2, which allows you to specify the pins to use.

It should be possible to use them together without doing this as well, though. If you'd like to try using the existing pin configuration, can you please post your sketch? Perhaps in a new thread if you're going to do that, as it will probably require some more back-and-forth?

Thanks,

Angus

Hobohome
Posts: 9
Joined: Sat Dec 21, 2013 12:39 am

Re: New beta release "DMD2" Library

Post by Hobohome » Sun Dec 07, 2014 9:59 pm

Thanks Angus,

I'm going to go with the rewire option. Here is what I am planning to do...
Use the DMD connector but plug it into the Arduino so that the AREF and GND pins sit over the RX and TX (pin 0 and pin 1) - I will cut these pins off and solder a new GND connection from the Arduino to the DMD connector.
This will give me PINS 2,3,4,5,6,7,8 & 9 to drive with the softDMD function.
Do you think that this will work ok?

Cheers

Post Reply