Printing a String
Printing a String
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
-
- Posts: 144
- Joined: Fri Sep 20, 2013 7:25 am
Re: Printing a String
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.
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.
Re: Printing a String
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);
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);