Printing array value problem

Hello everybody. I try to print on my TFT screen on value in an array but I always get value PLUS 48… ie if I store 7 in the array I will get 55 if I print it on the TFT.
What is that !? I guess it’s something with the pointers but what ?

Thank you by advance

Guillaume

#include <MCUFRIEND_kbv.h>
#include <Adafruit_GFX.h>
#include <HX711.h> //Librairie de l'amplificateur des capteurs de force
#include <Keypad.h>

const byte ROWS = 4; // Four rows
const byte COLS = 3; // Three columns
byte rowPins[ROWS] = { 53, 51, 49, 47 }; // Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte colPins[COLS] = { 45, 43, 41 }; // Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte compteTouche = 0;
byte negatif = 0;
byte j = 0;
byte i = 0;
byte test = 0;
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};// Define the Keymap
char Key = 0;
unsigned char saisieInt[5] = {0, 0, 0, 0, 0};//tableau des chiffres saisis
int nombreSaisi = 0;//association des différents chiffres saisis
int xText = 10;
int yText = 30;

Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); //crée le clavier
MCUFRIEND_kbv tft; //crée l'écran



void setup() {

tft.reset();//initialisation de l'écran et des masques
tft.begin(0x9481);
tft.setRotation(1);
tft.setTextSize(3);
tft.fillScreen(0x0000);
tft.setTextSize(2);
tft.setCursor(10,10);
tft.println("Nombre saisi:");
}

void loop() {


tft.setCursor(xText,yText);
Key = kpd.getKey();

if (Key)
  {  
    switch(Key)
    {
    case('*')://correction de saisie
    break;
    case('#')://validation, on prend les chiffres saisis et on en fait un nombre
    break;
    default:
    saisieInt[compteTouche]=Key;
    tft.print(saisieInt[compteTouche]);//affichage sur l'écran ddu dernier chiffre saisi
    compteTouche++;
    xText=xText+24;
  }
 }
}

You print a char (the type of saisieInt array is unsigned char) but you expect to read an int. Character encodings for digits goes from 48 ('0' char) to 57 ('9' char), that's why if you expect to see 7, you'll see 7 + '0' = 7 + 48 : )

THANK YOU SO MUCH ! I was really becoming crazy… I’ll write your speudonym in golden letters on the box of my project :wink:

Guillaume

Ahah! Your'e welcome buddy : )