So here is the new post.
If I print a string directly with lcd.print("somestring");, it works. But if I print a string via a variable, it displays just one character (as shown in the picture).
#include <Wire.h>
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h>
float temp;
bool HHein;
int tempPin = 0;
int HHeinPin = 2;
char HHeinOut;
hd44780_I2Cexp lcd;
void setup()
{
pinMode (2, INPUT);
lcd.begin(16,2);
HHein = LOW;
}
void loop()
{
temp = analogRead(tempPin);
temp = temp * 0.02;
//HHein = digitalRead(HHeinPin);
HHein = LOW;
if (HHein == HIGH){
HHeinOut = "ein";
}
else {
HHeinOut = "aus";
}
lcd.clear();
lcd.setCursor (0,0);
lcd.print("Boiler: ");
lcd.print(temp);
lcd.print(" C");
lcd.setCursor (0,1);
lcd.print("Heizung: ");
lcd.print(HHeinOut);
delay(1000);
}
The result is lcd1.jpg.
lcd2.jpg + lcd3.jpg are showing the lcd module.
If I use the LiquidCystal_I2C library, it shows a "&" with the same code.
If I use this code, it works (lcd4.jpg):
#include <Wire.h>
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h>
float temp;
bool HHein;
int tempPin = 0;
int HHeinPin = 2;
char HHeinOut;
hd44780_I2Cexp lcd;
void setup()
{
pinMode (2, INPUT);
lcd.begin(16,2);
HHein = LOW;
}
void loop()
{
temp = analogRead(tempPin);
temp = temp * 0.02;
//HHein = digitalRead(HHeinPin);
HHein = LOW;
lcd.clear();
lcd.setCursor (0,0);
lcd.print("Boiler: ");
lcd.print(temp);
lcd.print(" C");
lcd.setCursor (0,1);
lcd.print("Heizung: ");
if (HHein == HIGH){
lcd.print("ein");
}
else {
lcd.print("aus");
}
//lcd.print(HHeinOut);
delay(1000);
}
Nadine