nokia lcd 5110

hello,

I've the nokia lcd 5110 module. So, I must print the decade numbers from convert Distance in cm from my HC-SR04 module. Have you idea how I can do that? Because, the PCD8544 library haves only functions which they print characters.

Check out http://www.arduino.cc/playground/Code/PCD8544 and http://blog.stuartlewis.com/2011/02/12/scrolling-text-with-an-arduino-and-nokia-5110-screen/

The first one definately gives you the option of printing a string, using the LcdString function.

Onions.

how can I convert the character-string function into number dec? I know a function String(value, DEC); Moreover, I write you my code

void loop()
{

  LcdClear();
  gotoXY(0, 2);
  distance = ultrasonic.Ranging(CM);
  
  LcdCharacter(ultrasonic.Ranging(CM));  // this functhion give me the character no decade numder !!!

  LcdString("cm");
    
  delay(3500);
}

I would like this http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1272177425

furthermore, I believe the solution is in this function,

void LcdWrite(byte dc, byte data)
{
  digitalWrite(PIN_DC, dc);
  digitalWrite(PIN_SCE, LOW);
  shiftOut(PIN_SDIN, PIN_SCLK, MSBFIRST, data);
  digitalWrite(PIN_SCE, HIGH);
}
[code]

how can I shiftout() DEC number and no byte data???

[/code]

What data do you want to display on the LCD? It may just be a case of adding a number to the number you have. Check out the ASCII table: http://www.harryrabbit.co.uk/electronics/ASCII%20table.html

If you want to display the number 33, the character shown will be ‘!’. To get the LCD to show the number 33, a series of steps will need to be taken:

Split the number up into digits, which we’ll store in an array:

array[0] = num % 10;
num = num / 10;
(repeat until num = 0)

If num was 33, the array will now have the values 3, 3. (Because of the way the above code processes the data, if num was 35, the array will now have the values 5, 3).

Next, turn the data in the array into a character. It is now the ASCII table comes in handy. If we assume a number of 0, we need to add 48 to it to produce the character 0. If the number is 3, we still need to add 48 to it to produce its character:

array = array + 48;
Then we need to start at the end of the array and work backwards, printing out the characters.
```
*while(num){
  array[i] = num % 10;
  num = num / 10;
  i++;
}

arrayLegnth = i;

for(int j = 0; j < i; j++){
  array[j] = array[j] + 48;
}

while(i){
  LcdCharacter(array[i]);
  i–;
}
_
```*_
It should work…
Onions.

the solution of old problem

http://www.cplusplus.com/reference/clibrary/cstdlib/itoa/