# display decimal value on TFTscreen help

I have the robot TFT screen and i am using it for a small project.

I have a voltage sensor connected to analog pin A0 detects voltage 0-5v. The voltage measured is from a resistor voltage divider that lowers DC voltage from a battery down from 15v(max)-5v(max) for the arduino.

I am struggling on how to convert the measured value 0-5 back up the 0-15v value with a 1 decimal place accuracy and display it on the TFT screen.

i want to extrapolate the measured value back to a voltage (i.e 12.8v). I count 12.8v as 5 chars: [1] - 1 [2] - 2 [3] - . [4] - 8 [5] - v

so i want to get the measured value (A0) convert to voltage in 0-15vdc range with 1 decimal place accuracy and append a 'v' on the end. Place all this in a 5 char array and print it on the screen.

i tried using the map function in psuedo code as follows:

``````// char array to print to the screen
char volSen[5];

int voltageSensor = 0;

//read the voltage from the sensor connected to A0

String batteryVoltage = map(voltageSensor, 0,1023,0,15);

//send voltage to array
batteryVoltage.toCharArry(volSen, 5);

//HOW DO I APPEND A 'v' AT THE END OF THE ARRAY??

//Print the voltage on the TFT screen
TFTscreen.text(volSen,0,0);
``````

You need a null byte at the end of your string so the length of the char array should be 6 not 5.

//HOW DO I APPEND A 'v' AT THE END OF THE ARRAY??

strcat( volSen,"v");