How to display Full text in LCD with i2c board

My problem is when i get my data(T) and display it on the lcd it only shows the 1st digit and its decimal. also when I try to put text when I press "C" it only shows the first letter.

Heres the code:

#include <Key.h>
#include <Keypad.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

#define THERMISTORPIN A0
#define THERMISTORNOMINAL 10000
#define TEMPERATURENOMINAL 25
#define NUMSAMPLES 5
#define BCOEFFICIENT 3950
#define SERIESRESISTOR 10000

const byte ROWS = 4;
const byte COLS = 4;

char keymap[ROWS][COLS] =
{
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'.', '0', '#', 'D'}
};

byte rowPins[ROWS] = {9, 8, 7, 6};
byte colPins[COLS] = {5, 4, 3, 2};

Keypad myKeypad = Keypad(makeKeymap(keymap), rowPins, colPins, ROWS, COLS);

LiquidCrystal_I2C lcd(0x27, 20, 4);

int cursorColumn = 0;
int samples[NUMSAMPLES];

void setup() {
lcd.backlight();
lcd.init();

Serial.begin(9600);
analogReference(EXTERNAL);
}

void loop() {

char Keypressed = myKeypad.getKey();

if (Keypressed != NO_KEY)
{
lcd.print(Keypressed);
tone(10, 1500);
noTone(10);
}
if (Keypressed == 'D')
{
lcd.clear();
}
lcd.blink();

if (Keypressed == 'C')
{
lcd.clear();
uint8_t i;
float average;

for (i = 0; i < NUMSAMPLES; i++) {
  samples[i] = analogRead(THERMISTORPIN);
  delay(10);
}

// average all the samples out
average = 0;
for (i = 0; i < NUMSAMPLES; i++) {
  average += samples[i];
}
average /= NUMSAMPLES;

Serial.print("Average analog reading ");
Serial.println(average);

average = 1023 / average - 1;
average = SERIESRESISTOR / average;
Serial.print("Thermistor resistance ");
Serial.println(average);

float T;
T = average / THERMISTORNOMINAL;     // (R/Ro)
T = log(T);                  // ln(R/Ro)
T /= BCOEFFICIENT;                   // 1/B * ln(R/Ro)
T += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
T = 1.0 / T;                 // Invert
T -= 273.15;                         // convert absolute temp to C

Serial.print("Temperature ");
Serial.print(T);
Serial.println(" *C");
lcd.println(   T);


delay(500);

}
}Preformatted text

Please follow the advice given in the link below when posting code , use code tags and post the code here to make it easier to read and copy for examination

Do you intend doing further processing on the samples later?

If not, why not simply sum the samples as you read them?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.