Page 1 of 1
Syntax of DRAWTEXT with variables
Posted: Wed Jun 19, 2013 12:36 pm
by Smotz
Hi All,
Can someone give me the DRAWTEXT syntax to include text, then a variable, then text, then another variable?
Example:
VARa=60;
VARb=10;
ReefAngel.LCD.DrawText(0,255,x,y,"RC" VARa "% +/- " VARb "%");
I want it to say
RC 60% +/-10%
Re: Syntax of DRAWTEXT with variables
Posted: Wed Jun 19, 2013 12:41 pm
by lnevo
I dont think you can do that with DrawText by itself. You can use sprintf to create the string and then use DrawText to display it.
char buf[16];
sprintf(buf,"RC %d% +/-%d%",VarA,VarB);
Re: Syntax of DRAWTEXT with variables
Posted: Wed Jun 19, 2013 12:49 pm
by Smotz
lnevo wrote:I dont think you can do that with DrawText by itself. You can use sprintf to create the string and then use DrawText to display it.
char buf[16];
sprintf(buf,"RC %d% +/-%d%",VarA,VarB);
eww. not elegant, huh?
Would my code look like this?
char buf[16];
sprintf(buf,"RC %d% +/-%d%",wpWavStr,wpWavOff);
ReefAngel.LCD.DrawText(0,255,x,y,buf);
Re: Syntax of DRAWTEXT with variables
Posted: Wed Jun 19, 2013 1:00 pm
by lnevo
Yes. Keep in mind i'm writing the code on my phone...i'm doing that in a few places in my INO you can reference.
Re: Syntax of DRAWTEXT with variables
Posted: Wed Jun 19, 2013 1:02 pm
by Smotz
lnevo wrote:Yes. Keep in mind i'm writing the code on my phone...i'm doing that in a few places in my INO you can reference.
Again, Thank you so much. I'll review your code.