AnsweredAssumed Answered

Problem using sprintf with LCD

Question asked by johnt on Nov 2, 2012
Latest reply on Nov 4, 2012 by TomE

Hello everybody,

 

I'm trying to print the value of a int variable to one LCD but it's not working properly, I've tried many things but I would like to know how can I include a int variable to a normal a string that I want to print to the LCD.

 

I can only print normal texts to the LCD but without variables, for example doing this:

 

char *text="Hello world";

 

  while (*text)

  {  

    senddatatoLCD (*text++);  //Function made to send data to LCD in 2 lines using 4 bits only.

  }

 

I would like to build a string with value of int variable already included and then just send this string with a while loop as I've on the example shown before.

 

Something like this: sprintf (*string, "The value: %d", var);

 

and the use the *string to print it to the LCD.

 

Does someone knows how to do it?

 

Thanks in advance.

 

Outcomes