danielb:
if i write float TempC = 2250;
show 22500 °C
in serial monitor
show the temperature in this way : 19.4375000000
That's strange, I would expect to see: 2250 , wouldn't you?
I think the problem is the decimal
I must divide 19 from 43 without the dot ( or comma )
put 19 into a buffer and the 43 into another buffer
then show it
Right ???
thanks
Pretty much. You will need to adjust your buffer size to 5 and/or adjust your placement on the screen if you want to be able to show "19.43", since that is five characters and your existing code uses four. Or, you could show it as "19.4" and leave it where it is on the screen.
// returns temperature in degrees C
float getTempC(uint8_t*);
// returns temperature in degrees F
float getTempF(uint8_t*);
// Get temperature for device index (slow)
float getTempCByIndex(uint8_t);
// Get temperature for device index (slow)
float getTempFByIndex(uint8_t);
So, yes all the methods to get the temperature return a float, not an int.
Your buffer will need to be larger, and you'll need to use ftoa(), instead of itoa(). After that, you'll need to put more characters to the display.
lcd24x16_base___temperatura.cpp: In function 'void loop()':
lcd24x16_base___temperatura:112: error: invalid conversion from 'char*' to 'signed char'
c:/users/daniele/desktop/varie2/arduino-0023/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:581: error: too few arguments to function 'char* dtostrf(double, signed char, unsigned char, char*)'
lcd24x16_base___temperatura:112: error: at this point in file
danielb:
error: too few arguments to function 'char* dtostrf(double, signed char, unsigned char, char*)'
You aren't passing the correct number and type of arguments to dtostrf(). The documentation tells you what it expects. Only you know what you're actually providing, since we can't see your code, but it's obviously not correct. Change your code so it passes the arguments that the function expects.
I think you would do better to consider the code that Paul provided as an example and an opportunity to think about how it applies to your situation rather than something to just paste into your code and report back that it doesn't work.
You should ask yourself questions like
How wide do I want the number to be? e.g. "22.51345" would be 8 wide
What precision do I want it to have ? e.g. "-23.434" would be a precision of 3.
and
Is my buffer[] big enough to hold it?
Do I have room to put it on the LCD buffer[0], buffer[1], buffer[2],... buffer[width-1]