how to print a double

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: 99jonathan, roger, imaqine

how to print a double

Postby epokh » Thu May 03, 2007 5:00 pm

I need to print the a double value on the LCD.
Which kind of conversion I need?
If I do like:
double x=0.123232;
LCD.drawString("Value: ",x,1,1);
nothing is displayed because I bet the concatenation property is not implemented.
Any suggestions?
epokh
Novice
 
Posts: 26
Joined: Wed Feb 21, 2007 5:46 pm

Postby lawrie » Wed May 09, 2007 6:10 pm

Explicit use of StringBuffer works, e.g.

StringBuffer sb = new StringBuffer(16);

sb.append("Value: ");
sb.append(x);

LCD.drawString(sb.toString(),1,1);
LCD.refresh();
lawrie
leJOS Team Member
 
Posts: 917
Joined: Mon Feb 05, 2007 1:27 pm

Postby epokh » Fri May 11, 2007 2:08 pm

O gosh thanks!
epokh
Novice
 
Posts: 26
Joined: Wed Feb 21, 2007 5:46 pm


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 2 guests

more stuff