Printing a String

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
Post Reply
plito
Posts: 16
Joined: Sat Sep 23, 2017 8:24 pm

Printing a String

Post by plito » Thu May 10, 2018 3:39 pm

Is there any instruction in DMD library to print a string ? I´m trying to show the time on 2 dmd panels using an rtc3231 but I can´t print the variables ( hour, minutes, seconds ) . Thank you

Brissieboy
Posts: 109
Joined: Fri Sep 20, 2013 7:25 am

Re: Printing a String

Post by Brissieboy » Fri May 11, 2018 10:31 am

plinto,
Have a look at the examples provided in the library. They will show you how to do this. You can access them from 'Examples' under the 'File' menu . Unfortunately there is not a lot of documentation on how to use most libraries, and never enough comments provided in the code, but the examples are pretty straightforward.

plito
Posts: 16
Joined: Sat Sep 23, 2017 8:24 pm

Re: Printing a String

Post by plito » Sat May 12, 2018 9:41 pm

Thank you Brissieboy. I had to como to pieces each variable. I add the code for somebody who need it.

t = rtc.getTime();
temp=rtc.getTemp();
hora = t.hour;
minuto = t.min;
segund= t.sec;
unidadeHora = hora % 10;
dezenaHora = hora / 10;
unidadeMinuto = minuto % 10;
dezenaMinuto = minuto / 10;
unidaddeSegundo = segund % 10;
dezenaSegundo = segund / 10;
unidgrado=temp%10;
decgrado=temp/10;
if (unidaddeSegundo!=cambio )
{

//dmd.selectFont(Arial_Black_16);
dmd.drawChar(0,0,'0'+(dezenaHora), GRAPHICS_NORMAL);
dmd.drawChar(9,0,'0'+(unidadeHora), GRAPHICS_NORMAL);

dmd.drawString(18,0,":",1, GRAPHICS_OR);

dmd.drawChar(22,0,'0'+(dezenaMinuto), GRAPHICS_NORMAL);
dmd.drawChar(31,0,'0'+(unidadeMinuto), GRAPHICS_NORMAL);
dmd.selectFont(SystemFont5x7);

dmd.drawChar(46,0,'0'+(unidaddeSegundo), GRAPHICS_NORMAL);
dmd.drawChar(41,0,'0'+(dezenaSegundo), GRAPHICS_NORMAL);

dmd.drawChar(44,9,'0'+(decgrado),GRAPHICS_NORMAL);
dmd.drawChar(49,9,'0'+(unidgrado),GRAPHICS_NORMAL);
dmd.drawString( 54,9,"<",1,GRAPHICS_NORMAL);
dmd.drawString( 59,9,"C",1,GRAPHICS_NORMAL);
cambio=unidaddeSegundo;
delay(480);

}
dmd.selectFont(Arial_Black_16);
dmd.drawString(18,0,":",1,GRAPHICS_NOR);
delay(50);

Post Reply