lcd.write a custom character from an variable

Hi guys,
I need some support because I got stuck in one little issue.

this issue is:
depending on a certain decission a variable (Trendtemp) gets a value

void Temp_Trend()
{
  for (int Speicherplatz = 0; Speicherplatz < Wertespeicher; Speicherplatz++)

    Temp_Schnitt = Temp_Summe / Wertespeicher;
  if (Temp_Schnitt > Temp_Schnitt_old * 1.05)
  {
    Trendtemp = 3; //steigend
  }
  else if (Temp_Schnitt <= Temp_Schnitt_old * 1.05 && Temp_Schnitt >= Temp_Schnitt_old * 0.95)
  {
    Trendtemp = 6; //gleichbleibend
  }
  else if (Temp_Schnitt < Temp_Schnitt_old * 0.95)
  {
    Trendtemp = 4; //fallend
  }
}

The values 3, 6 and 4 are coresponding to custom characters to be written on lcd

 lcd.createChar(1, Thermometer);
  lcd.createChar(3, Pfeil_up);
  lcd.createChar(4, Pfeil_down);
  lcd.createChar(6, gleichbleibend);

this variable will then be built in to a Display variable

switch (x)
    {
      case 1:
        Text1 = "Temperatur";
        Symbol = 1;
        Wert = dht.readTemperature();
        Einheit = char(223)+String("C");
        Trend = Trendtemp;
        break;

The Display will then be updated with the different variables

void update_Display()
{
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print(Text1);
  lcd.setCursor(2, 1);
  lcd.write(byte(Symbol));
  lcd.setCursor(4, 1);
  lcd.print(Wert);
  lcd.setCursor(10, 1);
  lcd.print(Einheit);
  lcd.setCursor(13, 1);
  lcd.write(byte(Trend));
}

The issue is that the Trend variable does not result in the custom character on the LCD - it shows some weird character .

the variables are defined as

char Trendtemp;
byte Trend;

I would be thankful if somebody could help me in this issue and I hope all relevant informations are described.

thank you and best regards
ftf

ftf74: The issue is that the Trend variable does not result in the custom character on the LCD - it shows some weird character .

You are posting only incomplete code snippets. Hard to guess what's going on in the rest of the code that you missed to post along with your question.

I cannot see which custom characters you actually create with:

 lcd.createChar(3, Pfeil_up);
  lcd.createChar(4, Pfeil_down);
  lcd.createChar(6, gleichbleibend);

Perhaps you create the same weird character here that you will see on the LCD later?

And in your update_Display() function you do some:

lcd.write(byte(Symbol));

but I never can see the value 'Symbol' has at that point of the program while being executed. Maybe a wrong value in 'Symbol' while writing it to LCD?

BTW: Your "decission" (decision?) logic also looks very strange to me.

if (Temp_Schnitt > Temp_Schnitt_old * 1.05)
{
    Trendtemp = 3; //steigend
}

So in winter when the 'Temp_Schnitt_old' is 1.0°C, you will get a 'steigend' if the temperature rises above 1.0*1.05= 1.05°C?

But in summer when the 'Temp_Schnitt_old' is 30.0°C, you will get a 'steigend' if the temperature rises above 30*1.05 = 31,5°C?

A 'steigend' temperature trend needs a rise of temperature of 0.05°C in winter, but 1.50°C in summer? Really?

BTW: If your code is commented in German only, which might be hard to understand for international forum users, why don't you post your questions in the German forum instead?

Or if you like it more asking questions in the international forum, why don't you comment the code in English?

And why don't you post a full example that demonstrates the problem? Why do you just post small code snippets that show nothing about the problem?

Thank you for replying,
the code is not ready so the trend algorithm will come later to be verified.
But thank youi for your hint!!!

the intention was to just show the important code which generates the problem.
I think I have a mess in converting bytes to char or vice versa.

the lcd.createChar draws the correct characters. this is ok for sure

Related to “Symbol” you mentioned.
Symbol and trend are “drawing” customized characters.
The only difference is (as you can see here)

switch (x)
{
case 1:
Text1 = “Temperatur”;
Symbol = 1;
Wert = dht.readTemperature();
Einheit = char(223)+String(“C”);
Trend = Trendtemp;
break;

that Symbol is “hardcoded” with “1” - which results in drawing the CORRECT customized character with the update display routine
void update_Display()
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(Text1);
lcd.setCursor(2, 1);
lcd.write(byte(Symbol));
lcd.setCursor(4, 1);
lcd.print(Wert);
lcd.setCursor(10, 1);
lcd.print(Einheit);
lcd.setCursor(13, 1);
lcd.write(byte(Trend));
}

The “Trend” is not “hardcoded” - it should be given by another variable. Which can be seen here

void Temp_Trend()
{
for (int Speicherplatz = 0; Speicherplatz < Wertespeicher; Speicherplatz++)

Temp_Schnitt = Temp_Summe / Wertespeicher;
if (Temp_Schnitt > Temp_Schnitt_old * 1.05)
{
Trendtemp = 3; //steigend
}
else if (Temp_Schnitt <= Temp_Schnitt_old * 1.05 && Temp_Schnitt >= Temp_Schnitt_old * 0.95)
{
Trendtemp = 6; //gleichbleibend
}
else if (Temp_Schnitt < Temp_Schnitt_old * 0.95)
{
Trendtemp = 4; //fallend
}
}

I thought to give the value 3,6 or 4 to a trend variable,
then put this value into another variable
Trend = Trendtemp;
to be able to update the LCD with the common customized character for 3,6,or 4 which are defined with the lcd.createChar command

And this is the mess.

thank you