Elegoo 2.8TFT LCD Temperaturabfrage

Hallo zusammen,

ganz vorweg ich bin in dem Thema noch ziemlich neu.

Ich habe zwei Probleme und hoffe ihr könnt mir dabei helfen.

Und zwar möchte ich mit einem Arduino Mega 2560 3 Temperatursensoren (TMP36) und 1 Akkuzelle abfragen. Diese Werte möchte ich auf dem Elegoo 2.8TFT LCD (ILI9341) wiedergeben.

Temp. Abfrage:

Ich habe 3 Temp. Sensoren

  1. Regler Temp.
  2. Motor Temp.
  3. Akku Temp.

Die Werte möchte ich auch dem Display angezeigt bekommen und sobald eine der Temperaturen über einen bestimmten wert kommen sollte ein Signal (Piezo) ertönen oder eine LED leuchten oder der Display mich irgendwie drauf hinweisen.

Reichweiten abfrage:

Hier würde ich gerne eine Zelle von meinem Akku abfragen der Wert liegt zwischen 3,8 und 4,2Volt

zb. :

4,2Volt = 100km
4,1Volt = 75km
4,0Volt = 50km
3,9Volt = 25km
3,8Volt = 0Km

und bei ~25km ein Warnsignal (LED oder Display) ausgeben.

Was ich habe bis jetzt :

Das Programm dazu:

// IMPORTANT: Elegoo_TFTLCD LIBRARY MUST BE SPECIFICALLY
// CONFIGURED FOR EITHER THE TFT SHIELD OR THE BREAKOUT BOARD.
// SEE RELEVANT COMMENTS IN Elegoo_TFTLCD.h FOR SETUP.

#include <Elegoo_GFX.h>    // Core graphics library
#include <Elegoo_TFTLCD.h> // Hardware-specific library

// The control pins for the LCD can be assigned to any digital or
// analog pins...but we'll use the analog pins as this allows us to
// double up the pins with the touch screen (see the TFT paint example).
#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0

#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin

// When using the BREAKOUT BOARD only, use these 8 data lines to the LCD:
// For the Arduino Uno, Duemilanove, Diecimila, etc.:
//   D0 connects to digital pin 8  (Notice these are
//   D1 connects to digital pin 9   NOT in order!)
//   D2 connects to digital pin 2
//   D3 connects to digital pin 3
//   D4 connects to digital pin 4
//   D5 connects to digital pin 5
//   D6 connects to digital pin 6
//   D7 connects to digital pin 7
// For the Arduino Mega, use digital pins 22 through 29
// (on the 2-row header at the end of the board).

// Assign human-readable names to some common 16-bit color values:
#define BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF

Elegoo_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
// If using the shield, all control and data lines are fixed, and
// a simpler declaration can optionally be used:
// Elegoo_TFTLCD tft;

void setup(void) {
  Serial.begin(9600);
  Serial.println(F("TFT LCD test"));

#ifdef USE_Elegoo_SHIELD_PINOUT
  Serial.println(F("Using Elegoo 2.8\" TFT Arduino Shield Pinout"));
#else
  Serial.println(F("Using Elegoo 2.8\" TFT Breakout Board Pinout"));
#endif

  Serial.print("TFT size is "); Serial.print(tft.width()); Serial.print("x"); Serial.println(tft.height());

  tft.reset();

  uint16_t identifier = tft.readID();
identifier=0x9341;
  if(identifier == 0x9325) {
    Serial.println(F("Found ILI9325 LCD driver"));
  } else if(identifier == 0x9328) {
    Serial.println(F("Found ILI9328 LCD driver"));
  } else if(identifier == 0x7575) {
    Serial.println(F("Found HX8347G LCD driver"));
  } else if(identifier == 0x9341) {
    Serial.println(F("Found ILI9341 LCD driver"));
  } else if(identifier == 0x8357) {
    Serial.println(F("Found HX8357D LCD driver"));
  } else {
    Serial.print(F("Unknown LCD driver chip: "));
    Serial.println(identifier, HEX);
    Serial.println(F("If using the Elegoo 2.8\" TFT Arduino shield, the line:"));
    Serial.println(F("  #define USE_Elegoo_SHIELD_PINOUT"));
    Serial.println(F("should appear in the library header (Elegoo_TFT.h)."));
    Serial.println(F("If using the breakout board, it should NOT be #defined!"));
    Serial.println(F("Also if using the breakout, double-check that all wiring"));
    Serial.println(F("matches the tutorial."));
    return;
  }

  tft.begin(identifier);

  Serial.println(F("Benchmark                Time (microseconds)"));


  Serial.print(F("Text                     "));
  Serial.println(testText());
  delay(3000);

  
  Serial.println(F("Done!"));
}

void loop(void) {
  for(uint8_t rotation=3; rotation=3; rotation++) {
    tft.setRotation(rotation);
    testText();
    delay(20000);
  }
}

unsigned long testFillScreen() {
  unsigned long start = micros();
  tft.fillScreen(BLACK);
  tft.fillScreen(RED);
  tft.fillScreen(GREEN);
  tft.fillScreen(BLUE);
  tft.fillScreen(BLACK);
  return micros() - start;
}

unsigned long testText() {
  tft.fillScreen(BLACK);
  unsigned long start = micros();
  tft.setCursor(0, 0);
  
  tft.setTextColor(WHITE);
  tft.setTextSize(3);
  tft.println("Regler Temp.");
  tft.println("");
  tft.println("Motor  Temp.");
  tft.println("");
  tft.println("Batt.  Temp.");
  tft.println("");
  tft.println("Reichweite");
  tft.println("");
  tft.setCursor(270, 145);
  tft.setTextColor(WHITE);
  tft.println("KM");
  tft.println("");
  return micros() - start;
}

Ich habe leider keine Programmschnipsel gefunden die mir dabei weiter helfen könnten die Temperaturabfrage und die abfrage der Zelle im Display anzuzeigen.

Vlt hat ja von euch einer da etwas rumfliegen was mir weiter helfen könnte. :grinning:

Danke im vorraus.

hier mal ein keiner Schnipsel zur Spannungsüberwachung

/*
 * Spannungsüberwachung einer Lipozelle
 * Lipozelle zwischen A5 und GND angeschlossen
 */
 const byte uBatPin=A5;
 float uBat;
 byte reichweite;
void setup() {
  Serial.begin(9600);

}

void loop() {
  uBat = analogRead(uBatPin)/1024*5.0;// 5.0 durch die gemessene Versorgungsspannung ersetzen
  Serial.println(uBat);
  if(uBat>4.1) reichweite = 100;
  if(uBat<4.1 && uBat>4.0) reichweite =75;
  if(uBat<4.0 && uBat>3.9) reichweite =50;
  //usw
  Serial.println (reichweite);
}

Hier findest du noch was zur Temperatur-Messung mit dem TMP36

Hallo ardubu,

super das werde ich nachher mal einbauen und ausprobieren.

Danke. 8)

So Spannungsüberwachung eingebunden und mir wird auch eine "0" angezeigt soweit so gut.....
Gebe ich aber Spannung (5V auf den Eingang (A10) verändert sich der Wert aber nicht.

Habe ich wohl irgendetwas vergessen :o

// IMPORTANT: Elegoo_TFTLCD LIBRARY MUST BE SPECIFICALLY
// CONFIGURED FOR EITHER THE TFT SHIELD OR THE BREAKOUT BOARD.
// SEE RELEVANT COMMENTS IN Elegoo_TFTLCD.h FOR SETUP.

#include <Elegoo_GFX.h>    // Core graphics library
#include <Elegoo_TFTLCD.h> // Hardware-specific library

// The control pins for the LCD can be assigned to any digital or
// analog pins...but we'll use the analog pins as this allows us to
// double up the pins with the touch screen (see the TFT paint example).
#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0

#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin

// When using the BREAKOUT BOARD only, use these 8 data lines to the LCD:
// For the Arduino Uno, Duemilanove, Diecimila, etc.:
//   D0 connects to digital pin 8  (Notice these are
//   D1 connects to digital pin 9   NOT in order!)
//   D2 connects to digital pin 2
//   D3 connects to digital pin 3
//   D4 connects to digital pin 4
//   D5 connects to digital pin 5
//   D6 connects to digital pin 6
//   D7 connects to digital pin 7
// For the Arduino Mega, use digital pins 22 through 29
// (on the 2-row header at the end of the board).

// Assign human-readable names to some common 16-bit color values:
#define BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF

Elegoo_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
// If using the shield, all control and data lines are fixed, and
// a simpler declaration can optionally be used:
// Elegoo_TFTLCD tft;

//----------------------------Spannungsüberwachung Lipo --------------------------------------

/*
 * Spannungsüberwachung einer Lipozelle
 * Lipozelle zwischen A10 und GND angeschlossen
 */
 const byte uBatPin=A10;
 float uBat;
 byte reichweite;
//---------------------------------------------------------------------------------------------
 
void setup(void) {
  Serial.begin(9600);
  Serial.println(F("TFT LCD test"));

#ifdef USE_Elegoo_SHIELD_PINOUT
  Serial.println(F("Using Elegoo 2.8\" TFT Arduino Shield Pinout"));
#else
  Serial.println(F("Using Elegoo 2.8\" TFT Breakout Board Pinout"));
#endif

  Serial.print("TFT size is "); Serial.print(tft.width()); Serial.print("x"); Serial.println(tft.height());

  tft.reset();

  uint16_t identifier = tft.readID();
identifier=0x9341;
  if(identifier == 0x9325) {
    Serial.println(F("Found ILI9325 LCD driver"));
  } else if(identifier == 0x9328) {
    Serial.println(F("Found ILI9328 LCD driver"));
  } else if(identifier == 0x7575) {
    Serial.println(F("Found HX8347G LCD driver"));
  } else if(identifier == 0x9341) {
    Serial.println(F("Found ILI9341 LCD driver"));
  } else if(identifier == 0x8357) {
    Serial.println(F("Found HX8357D LCD driver"));
  } else {
    Serial.print(F("Unknown LCD driver chip: "));
    Serial.println(identifier, HEX);
    Serial.println(F("If using the Elegoo 2.8\" TFT Arduino shield, the line:"));
    Serial.println(F("  #define USE_Elegoo_SHIELD_PINOUT"));
    Serial.println(F("should appear in the library header (Elegoo_TFT.h)."));
    Serial.println(F("If using the breakout board, it should NOT be #defined!"));
    Serial.println(F("Also if using the breakout, double-check that all wiring"));
    Serial.println(F("matches the tutorial."));
    return;
  }

  tft.begin(identifier);

  Serial.println(F("Benchmark                Time (microseconds)"));


  Serial.print(F("Text                     "));
  Serial.println(testText());
  delay(3000);

  
  Serial.println(F("Done!"));
}

void loop(void) {
  //for(uint8_t rotation=3; rotation=3; rotation++) {
    tft.setRotation(3);
    testText();
    delay(2000);
  }


unsigned long testFillScreen() {
  unsigned long start = micros();
  tft.fillScreen(BLACK);
  tft.fillScreen(RED);
  tft.fillScreen(GREEN);
  tft.fillScreen(BLUE);
  tft.fillScreen(BLACK);
  return micros() - start;
}

unsigned long testText() {
  tft.fillScreen(BLACK);
  unsigned long start = micros();

 
 
  tft.setCursor(0, 0);  
  tft.setTextColor(WHITE);
  tft.setTextSize(3);
  tft.println("Regler Temp.");
  tft.println("");
  tft.println("Motor  Temp.");
  tft.println("");
  tft.println("Batt.  Temp.");
  tft.println("");
  tft.println("Reichweite");
  tft.println("");
  tft.setCursor(270, 145);
  tft.setTextColor(WHITE);
  tft.println("KM");

//----------------------------Spannungsüberwachung Lipo --------------------------------------
 tft.setTextColor(GREEN);
  tft.setCursor(250, 145);
  tft.println(reichweite);
  

//---------------------------------------------------------------------------------------------

  return micros() - start;

//----------------------------Spannungsüberwachung Lipo --------------------------------------

  uBat = analogRead(uBatPin)/1024*4.2;// 4.2ch die gemessene Versorgungsspannung ersetzen
  Serial.println(uBat);
  if(uBat>4.1) reichweite = 100;
  if(uBat<4.1 && uBat>4.0) reichweite =75;
  if(uBat<4.0 && uBat>3.9) reichweite =50;
  if(uBat<3.9 && uBat>3.8) reichweite =25;
  if(uBat<3.8 && uBat>3.6) reichweite =0;
  //usw
  Serial.println (reichweite);
  
}
//---------------------------------------------------------------------------------------------

versuch es mal so

//----------------------------Spannungsüberwachung Lipo --------------------------------------

  uBat = analogRead(uBatPin)*4.2/1024;// 4.2ch die gemessene Versorgungsspannung ersetzen
  Serial.println(uBat);
  if(uBat>4.1) reichweite = 100;
  if(uBat<4.1 && uBat>4.0) reichweite =75;
  if(uBat<4.0 && uBat>3.9) reichweite =50;
  if(uBat<3.9 && uBat>3.8) reichweite =25;
  if(uBat<3.8 && uBat>3.6) reichweite =0;
  //usw
  Serial.println (reichweite);

Hat leider auch nix geändert.

Habe dann die Temperaturabfrage auch mit eingebaut um zu sehen ob es da geht, ist leider auch nicht der Fall. Kann das sein das der Display vlt nicht "Aktualisiert" wird?

Er "Flackert" zwar alle 2-3 sec. aber ich bin mir nicht sicher ob er dabei die Alten werte löscht und die neuen schreibt.

Was auch auffällig ist, ist das die Temp. Anzeigen schon Werte anzeigen ohne das dort etwas angeschlossen ist.
Aber das ist die nächste Baustelle denke ich. :grinning:

// IMPORTANT: Elegoo_TFTLCD LIBRARY MUST BE SPECIFICALLY
// CONFIGURED FOR EITHER THE TFT SHIELD OR THE BREAKOUT BOARD.
// SEE RELEVANT COMMENTS IN Elegoo_TFTLCD.h FOR SETUP.

#include <Elegoo_GFX.h> // Core graphics library
#include <Elegoo_TFTLCD.h> // Hardware-specific library

// The control pins for the LCD can be assigned to any digital or
// analog pins...but we'll use the analog pins as this allows us to
// double up the pins with the touch screen (see the TFT paint example).
#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0

#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin

// When using the BREAKOUT BOARD only, use these 8 data lines to the LCD:
// For the Arduino Uno, Duemilanove, Diecimila, etc.:
// D0 connects to digital pin 8 (Notice these are
// D1 connects to digital pin 9 NOT in order!)
// D2 connects to digital pin 2
// D3 connects to digital pin 3
// D4 connects to digital pin 4
// D5 connects to digital pin 5
// D6 connects to digital pin 6
// D7 connects to digital pin 7
// For the Arduino Mega, use digital pins 22 through 29
// (on the 2-row header at the end of the board).

// Assign human-readable names to some common 16-bit color values:
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF

Elegoo_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
// If using the shield, all control and data lines are fixed, and
// a simpler declaration can optionally be used:
// Elegoo_TFTLCD tft;

//----------------------------Spannungsüberwachung Lipo --------------------------------------

/*

  • Spannungsüberwachung einer Lipozelle
  • Lipozelle zwischen A10 und GND angeschlossen
    */
    const byte uBatPin=A10;
    float uBat;
    byte reichweite;
    //---------------------------------------------------------------------------------------------

//----------------------------Temperaturüberwachung ------------------------------------------

int regler = A11; //Der Sensor soll am analogen Pin A0 angeschlossen werden. Wir nennen den Pin ab jetzt "regler"
int motor = A12; //Der Sensor soll am analogen Pin A0 angeschlossen werden. Wir nennen den Pin ab jetzt "motor"
int akku = A13; //Der Sensor soll am analogen Pin A0 angeschlossen werden. Wir nennen den Pin ab jetzt "akku"
int sensorwert;
int temperatur = 0; //Unter der Variablen "temperatur" wird später der Temperaturwert abgespeichert.
int t=500; //Der Wert für „t“ gibt im Code die zeitlichen Abstände zwischen den einzelnen Messungen vor.

//---------------------------------------------------------------------------------------------
void setup(void) {
Serial.begin(9600);
Serial.println(F("TFT LCD test"));

#ifdef USE_Elegoo_SHIELD_PINOUT
Serial.println(F("Using Elegoo 2.8" TFT Arduino Shield Pinout"));
#else
Serial.println(F("Using Elegoo 2.8" TFT Breakout Board Pinout"));
#endif

Serial.print("TFT size is "); Serial.print(tft.width()); Serial.print("x"); Serial.println(tft.height());

tft.reset();

uint16_t identifier = tft.readID();
identifier=0x9341;
if(identifier == 0x9325) {
Serial.println(F("Found ILI9325 LCD driver"));
} else if(identifier == 0x9328) {
Serial.println(F("Found ILI9328 LCD driver"));
} else if(identifier == 0x7575) {
Serial.println(F("Found HX8347G LCD driver"));
} else if(identifier == 0x9341) {
Serial.println(F("Found ILI9341 LCD driver"));
} else if(identifier == 0x8357) {
Serial.println(F("Found HX8357D LCD driver"));
} else {
Serial.print(F("Unknown LCD driver chip: "));
Serial.println(identifier, HEX);
Serial.println(F("If using the Elegoo 2.8" TFT Arduino shield, the line:"));
Serial.println(F(" #define USE_Elegoo_SHIELD_PINOUT"));
Serial.println(F("should appear in the library header (Elegoo_TFT.h)."));
Serial.println(F("If using the breakout board, it should NOT be #defined!"));
Serial.println(F("Also if using the breakout, double-check that all wiring"));
Serial.println(F("matches the tutorial."));
return;
}

tft.begin(identifier);

Serial.println(F("Benchmark Time (microseconds)"));

Serial.print(F("Text "));
Serial.println(testText());
delay(3000);

Serial.println(F("Done!"));
}

void loop(void) {
//for(uint8_t rotation=3; rotation=3; rotation++) {
tft.setRotation(3);
testText();
delay(2000);
}

unsigned long testFillScreen() {
unsigned long start = micros();
tft.fillScreen(BLACK);
tft.fillScreen(RED);
tft.fillScreen(GREEN);
tft.fillScreen(BLUE);
tft.fillScreen(BLACK);
return micros() - start;
}

unsigned long testText() {
tft.fillScreen(BLACK);
unsigned long start = micros();

tft.setCursor(0, 0);
tft.setTextColor(WHITE);
tft.setTextSize(3);
tft.println("Regler Temp.");
tft.println("");
tft.println("Motor Temp.");
tft.println("");
tft.println("Akku Temp.");
tft.println("");
tft.println("Reichweite");
tft.println("");
tft.setCursor(270, 145);
tft.setTextColor(WHITE);
tft.println("KM");

//----------------------------Spannungsüberwachung Lipo --------------------------------------
tft.setTextColor(GREEN);
tft.setCursor(250, 145);
tft.println(reichweite);
tft.setCursor(200, 200);
tft.setTextColor(WHITE);
tft.println(uBat);
tft.setCursor(280, 200);
tft.println("V");
tft.setCursor(0, 200);
tft.println("Akku-Zelle");

//----------------------------Temperaturüberwachung ------------------------------------------

tft.setTextColor(GREEN);
tft.setCursor(270, 0);
tft.println(regler);
tft.setCursor(270, 50);
tft.println(motor);
tft.setCursor(270, 100);
tft.println(akku);

//---------------------------------------------------------------------------------------------

return micros() - start;

//----------------------------Spannungsüberwachung Lipo --------------------------------------

uBat = analogRead(uBatPin)*4.2/1024;// 4.2 durch die gemessene Versorgungsspannung ersetzen
Serial.println(uBat);
if(uBat>4.1) reichweite = 100;
if(uBat<4.1 && uBat>4.0) reichweite =75;
if(uBat<4.0 && uBat>3.9) reichweite =50;
if(uBat<3.9 && uBat>3.8) reichweite =25;
if(uBat<3.8 && uBat>3.6) reichweite =0;
//usw
Serial.println (reichweite);

//----------------------------Temperaturüberwachung ------------------------------------------

sensorwert=analogRead(regler); //Auslesen des Sensorwertes.
sensorwert=analogRead(motor); //Auslesen des Sensorwertes.
sensorwert=analogRead(akku); //Auslesen des Sensorwertes.
temperatur= map(sensorwert, 0, 410, -50, 150); //Umwandeln des Sensorwertes mit Hilfe des "map" Befehls.
delay(t); // Nach jeder Messung ist je eine kleine Pause mit der Dauer „t“ in Millisekunden.
}
//---------------------------------------------------------------------------------------------

setze deine Sketche bitte in Code-Tags (</>)

//----------------------------Temperaturüberwachung ------------------------------------------

sensorwert=analogRead(regler); //Auslesen des Sensorwertes.
sensorwert=analogRead(motor); //Auslesen des Sensorwertes.
sensorwert=analogRead(akku); //Auslesen des Sensorwertes.
temperatur= map(sensorwert, 0, 410, -50, 150); //Umwandeln des Sensorwertes mit Hilfe des "map" Befehls.
delay(t); // Nach jeder Messung ist je eine kleine Pause mit der Dauer „t" in Millisekunden.

hier überschreibst du Sensorwert immer wieder, du brauchst 3 unterschiedliche Sensorwerte.
z.B. sensorwertMot
sensorwertAkku
sensorwertRegl
danach mußt du auch 3* mappen.

Hat leider auch nix geändert.

was zeigt der serielle Monitor an?

Mein serielle Moitor zeigt dieses :

TTFT LCD test
Using Elegoo 2.8" TFT Breakout Board Pinout
TFT size is 240x320
Found ILI9341 LCD driver
Benchmark Time (microseconds)
Text 208136
Done!

füg mal diese Zeile ein

//----------------------------Spannungsüberwachung Lipo --------------------------------------

  uBat = analogRead(uBatPin)*4.2/1024;// 4.2ch die gemessene Versorgungsspannung ersetzen
  Serial.print("uBat= ")
  Serial.println(uBat);
  if(uBat>4.1) reichweite = 100;
  if(uBat<4.1 && uBat>4.0) reichweite =75;
  if(uBat<4.0 && uBat>3.9) reichweite =50;
  if(uBat<3.9 && uBat>3.8) reichweite =25;
  if(uBat<3.8 && uBat>3.6) reichweite =0;
  //usw
  Serial.println (reichweite);

OK ist eingefügt jetzt sag mein serieller Monitor das:

TFT
Text 208136

TFT size is 240x320
Found ILI9341 LCD driver
Benchmark Time (microseconds)
Text 208136
TFT LCD test
Using Elegoo 2.8" TFT Breakout Board Pinout
TFT size is 240x320
Found ILI9341 LCD driver
Benchmark Time (microseconds)
Text 208136
Done!

setze mal diese Zeile

//---------------------------------------------------------------------------------------------

  return micros() - start;

ganz ans Ende

Habe es jetzt so eingefügt:

//---------------------------------------------------------------------------------------------

  return micros() - start;
}

Serieller monitor zeigt noch das selbe an und der TFT bleibt auch bei alten Bild.

kannst du den aktuellen Sketch mal in Cade-Tags hier einstellen

Das ist der Aktuelle sketch:

// IMPORTANT: Elegoo_TFTLCD LIBRARY MUST BE SPECIFICALLY
// CONFIGURED FOR EITHER THE TFT SHIELD OR THE BREAKOUT BOARD.
// SEE RELEVANT COMMENTS IN Elegoo_TFTLCD.h FOR SETUP.

#include <Elegoo_GFX.h>    // Core graphics library
#include <Elegoo_TFTLCD.h> // Hardware-specific library

// The control pins for the LCD can be assigned to any digital or
// analog pins...but we'll use the analog pins as this allows us to
// double up the pins with the touch screen (see the TFT paint example).
#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0

#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin

// When using the BREAKOUT BOARD only, use these 8 data lines to the LCD:
// For the Arduino Uno, Duemilanove, Diecimila, etc.:
//   D0 connects to digital pin 8  (Notice these are
//   D1 connects to digital pin 9   NOT in order!)
//   D2 connects to digital pin 2
//   D3 connects to digital pin 3
//   D4 connects to digital pin 4
//   D5 connects to digital pin 5
//   D6 connects to digital pin 6
//   D7 connects to digital pin 7
// For the Arduino Mega, use digital pins 22 through 29
// (on the 2-row header at the end of the board).

// Assign human-readable names to some common 16-bit color values:
#define BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF

Elegoo_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
// If using the shield, all control and data lines are fixed, and
// a simpler declaration can optionally be used:
// Elegoo_TFTLCD tft;

//----------------------------Spannungsüberwachung Lipo --------------------------------------

/*
 * Spannungsüberwachung einer Lipozelle
 * Lipozelle zwischen A10 und GND angeschlossen
 */
 const byte uBatPin=A10;
 float uBat;
 byte reichweite;
//---------------------------------------------------------------------------------------------

//----------------------------Temperaturüberwachung  ------------------------------------------

int regler = A11; //Der Sensor soll am analogen Pin A0 angeschlossen werden. Wir nennen den Pin ab jetzt "regler"
int motor = A12; //Der Sensor soll am analogen Pin A0 angeschlossen werden. Wir nennen den Pin ab jetzt "motor"
int akku = A13; //Der Sensor soll am analogen Pin A0 angeschlossen werden. Wir nennen den Pin ab jetzt "akku"
int sensorwertMotor;
int sensorwertRegler;
int sensorwertAkku;
int temperaturMotor = 0; //Unter der Variablen "temperatur" wird später der Temperaturwert abgespeichert.
int temperaturRegler = 1; //Unter der Variablen "temperatur" wird später der Temperaturwert abgespeichert.
int temperaturAkku = 2; //Unter der Variablen "temperatur" wird später der Temperaturwert abgespeichert.
int t=500; //Der Wert für „t“ gibt im Code die zeitlichen Abstände zwischen den einzelnen Messungen vor.

//---------------------------------------------------------------------------------------------
void setup(void) {
  Serial.begin(9600);
  //Serial.println(F("TFT LCD test"));


#ifdef USE_Elegoo_SHIELD_PINOUT
  Serial.println(F("Using Elegoo 2.8\" TFT Arduino Shield Pinout"));
#else
  Serial.println(F("Using Elegoo 2.8\" TFT Breakout Board Pinout"));
#endif

  Serial.print("TFT size is "); Serial.print(tft.width()); Serial.print("x"); Serial.println(tft.height());

  tft.reset();

  uint16_t identifier = tft.readID();
     identifier=0x9341;
  if(identifier == 0x9325) {
    Serial.println(F("Found ILI9325 LCD driver"));
  } else if(identifier == 0x9328) {
   Serial.println(F("Found ILI9328 LCD driver"));
  } else if(identifier == 0x7575) {
    Serial.println(F("Found HX8347G LCD driver"));
  } else if(identifier == 0x9341) {
    Serial.println(F("Found ILI9341 LCD driver"));
  } else if(identifier == 0x8357) {
    Serial.println(F("Found HX8357D LCD driver"));
  } else {
    Serial.print(F("Unknown LCD driver chip: "));
    Serial.println(identifier, HEX);
    Serial.println(F("If using the Elegoo 2.8\" TFT Arduino shield, the line:"));
    Serial.println(F("  #define USE_Elegoo_SHIELD_PINOUT"));
    Serial.println(F("should appear in the library header (Elegoo_TFT.h)."));
    Serial.println(F("If using the breakout board, it should NOT be #defined!"));
    Serial.println(F("Also if using the breakout, double-check that all wiring"));
    Serial.println(F("matches the tutorial."));
    return;
  }

  tft.begin(identifier);

  Serial.println(F("Benchmark                Time (microseconds)"));


  Serial.print(F("Text                     "));
  Serial.println(testText());
 delay(3000);

  
  Serial.println(F("Done!"));
}

void loop(void) {
  //for(uint8_t rotation=3; rotation=3; rotation++) {
    tft.setRotation(3);
    testText();
    delay(2000);
  }


unsigned long testFillScreen() {
  unsigned long start = micros();
  tft.fillScreen(BLACK);
  tft.fillScreen(RED);
  tft.fillScreen(GREEN);
  tft.fillScreen(BLUE);
  tft.fillScreen(BLACK);
  return micros() - start;
}

unsigned long testText() {
  tft.fillScreen(BLACK);
  unsigned long start = micros();

 
 
  tft.setCursor(0, 0);  
  tft.setTextColor(WHITE);
  tft.setTextSize(3);
  tft.println("Regler Temp.");
  tft.println("");
  tft.println("Motor  Temp.");
  tft.println("");
  tft.println("Akku  Temp.");
  tft.println("");
  tft.println("Reichweite");
  tft.println("");
  tft.setCursor(270, 145);
  tft.setTextColor(WHITE);
  tft.println("KM");

//----------------------------Spannungsüberwachung Lipo --------------------------------------
  tft.setTextColor(GREEN);
  tft.setCursor(250, 145);
  tft.println(reichweite);
  tft.setCursor(200, 200);
  tft.setTextColor(WHITE);
  tft.println(uBat);
  tft.setCursor(280, 200);
  tft.println("V");
  tft.setCursor(0, 200);
  tft.println("Akku-Zelle");  


  
//----------------------------Temperaturüberwachung  ------------------------------------------
 
  tft.setTextColor(GREEN);
  tft.setCursor(270, 0);
  tft.println(regler);
  tft.setCursor(270, 50);
  tft.println(motor);
  tft.setCursor(270, 100);
  tft.println(akku);


//---------------------------------------------------------------------------------------------

  return micros() - start;

//----------------------------Spannungsüberwachung Lipo --------------------------------------

  uBat = analogRead(uBatPin)*4.2/1024;// 4.2ch die gemessene Versorgungsspannung ersetzen
  Serial.print("uBat= ");
  Serial.println(uBat);
  if(uBat>4.1) reichweite = 100;
  if(uBat<4.1 && uBat>4.0) reichweite =75;
  if(uBat<4.0 && uBat>3.9) reichweite =50;
  if(uBat<3.9 && uBat>3.8) reichweite =25;
  if(uBat<3.8 && uBat>3.6) reichweite =0;
  //usw
  Serial.println (reichweite);
  Serial.print (reichweite);
  

//----------------------------Temperaturüberwachung  ------------------------------------------

sensorwertMotor=analogRead(regler); //Auslesen des Sensorwertes.
sensorwertAkku=analogRead(motor); //Auslesen des Sensorwertes.
sensorwertRegler=analogRead(akku); //Auslesen des Sensorwertes.
temperaturMotor= map(sensorwertMotor, 0, 410, -50, 150); //Umwandeln des Sensorwertes mit Hilfe des "map" Befehls.
temperaturRegler= map(sensorwertRegler, 0, 410, -50, 150); //Umwandeln des Sensorwertes mit Hilfe des "map" Befehls.
temperaturAkku= map(sensorwertAkku, 0, 410, -50, 150); //Umwandeln des Sensorwertes mit Hilfe des "map" Befehls.
delay(t); // Nach jeder Messung ist je eine kleine Pause mit der Dauer „t“ in Millisekunden.

//---------------------------------------------------------------------------------------------

  return micros() - start;
}

dann versuch es noch mal so

// IMPORTANT: Elegoo_TFTLCD LIBRARY MUST BE SPECIFICALLY
// CONFIGURED FOR EITHER THE TFT SHIELD OR THE BREAKOUT BOARD.
// SEE RELEVANT COMMENTS IN Elegoo_TFTLCD.h FOR SETUP.

#include <Elegoo_GFX.h>    // Core graphics library
#include <Elegoo_TFTLCD.h> // Hardware-specific library

// The control pins for the LCD can be assigned to any digital or
// analog pins...but we'll use the analog pins as this allows us to
// double up the pins with the touch screen (see the TFT paint example).
#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0

#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin

// When using the BREAKOUT BOARD only, use these 8 data lines to the LCD:
// For the Arduino Uno, Duemilanove, Diecimila, etc.:
//   D0 connects to digital pin 8  (Notice these are
//   D1 connects to digital pin 9   NOT in order!)
//   D2 connects to digital pin 2
//   D3 connects to digital pin 3
//   D4 connects to digital pin 4
//   D5 connects to digital pin 5
//   D6 connects to digital pin 6
//   D7 connects to digital pin 7
// For the Arduino Mega, use digital pins 22 through 29
// (on the 2-row header at the end of the board).

// Assign human-readable names to some common 16-bit color values:
#define BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF

Elegoo_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
// If using the shield, all control and data lines are fixed, and
// a simpler declaration can optionally be used:
// Elegoo_TFTLCD tft;

//----------------------------Spannungsüberwachung Lipo --------------------------------------

/*
 * Spannungsüberwachung einer Lipozelle
 * Lipozelle zwischen A10 und GND angeschlossen
 */
 const byte uBatPin=A10;
 float uBat;
 byte reichweite;
//---------------------------------------------------------------------------------------------

//----------------------------Temperaturüberwachung  ------------------------------------------

int regler = A11; //Der Sensor soll am analogen Pin A0 angeschlossen werden. Wir nennen den Pin ab jetzt "regler"
int motor = A12; //Der Sensor soll am analogen Pin A0 angeschlossen werden. Wir nennen den Pin ab jetzt "motor"
int akku = A13; //Der Sensor soll am analogen Pin A0 angeschlossen werden. Wir nennen den Pin ab jetzt "akku"
int sensorwertMotor;
int sensorwertRegler;
int sensorwertAkku;
int temperaturMotor = 0; //Unter der Variablen "temperatur" wird später der Temperaturwert abgespeichert.
int temperaturRegler = 1; //Unter der Variablen "temperatur" wird später der Temperaturwert abgespeichert.
int temperaturAkku = 2; //Unter der Variablen "temperatur" wird später der Temperaturwert abgespeichert.
int t=500; //Der Wert für „t" gibt im Code die zeitlichen Abstände zwischen den einzelnen Messungen vor.

//---------------------------------------------------------------------------------------------
void setup(void) {
  Serial.begin(9600);
  //Serial.println(F("TFT LCD test"));


#ifdef USE_Elegoo_SHIELD_PINOUT
  Serial.println(F("Using Elegoo 2.8\" TFT Arduino Shield Pinout"));
#else
  Serial.println(F("Using Elegoo 2.8\" TFT Breakout Board Pinout"));
#endif

  Serial.print("TFT size is "); Serial.print(tft.width()); Serial.print("x"); Serial.println(tft.height());

  tft.reset();

  uint16_t identifier = tft.readID();
     identifier=0x9341;
  if(identifier == 0x9325) {
    Serial.println(F("Found ILI9325 LCD driver"));
  } else if(identifier == 0x9328) {
   Serial.println(F("Found ILI9328 LCD driver"));
  } else if(identifier == 0x7575) {
    Serial.println(F("Found HX8347G LCD driver"));
  } else if(identifier == 0x9341) {
    Serial.println(F("Found ILI9341 LCD driver"));
  } else if(identifier == 0x8357) {
    Serial.println(F("Found HX8357D LCD driver"));
  } else {
    Serial.print(F("Unknown LCD driver chip: "));
    Serial.println(identifier, HEX);
    Serial.println(F("If using the Elegoo 2.8\" TFT Arduino shield, the line:"));
    Serial.println(F("  #define USE_Elegoo_SHIELD_PINOUT"));
    Serial.println(F("should appear in the library header (Elegoo_TFT.h)."));
    Serial.println(F("If using the breakout board, it should NOT be #defined!"));
    Serial.println(F("Also if using the breakout, double-check that all wiring"));
    Serial.println(F("matches the tutorial."));
    return;
  }

  tft.begin(identifier);

  Serial.println(F("Benchmark                Time (microseconds)"));


  Serial.print(F("Text                     "));
  Serial.println(testText());
 delay(3000);

  
  Serial.println(F("Done!"));
}

void loop(void) {
 
 
  tft.setCursor(0, 0);  
  tft.setTextColor(WHITE);
  tft.setTextSize(3);
  tft.println("Regler Temp.");
  tft.println("");
  tft.println("Motor  Temp.");
  tft.println("");
  tft.println("Akku  Temp.");
  tft.println("");
  tft.println("Reichweite");
  tft.println("");
  tft.setCursor(270, 145);
  tft.setTextColor(WHITE);
  tft.println("KM");

//----------------------------Spannungsüberwachung Lipo --------------------------------------
  tft.setTextColor(GREEN);
  tft.setCursor(250, 145);
  tft.println(reichweite);
  tft.setCursor(200, 200);
  tft.setTextColor(WHITE);
  tft.println(uBat);
  tft.setCursor(280, 200);
  tft.println("V");
  tft.setCursor(0, 200);
  tft.println("Akku-Zelle");  


  
//----------------------------Temperaturüberwachung  ------------------------------------------
 
  tft.setTextColor(GREEN);
  tft.setCursor(270, 0);
  tft.println(regler);
  tft.setCursor(270, 50);
  tft.println(motor);
  tft.setCursor(270, 100);
  tft.println(akku);


//---------------------------------------------------------------------------------------------


//----------------------------Spannungsüberwachung Lipo --------------------------------------

  uBat = analogRead(uBatPin)*4.2/1024;// 4.2ch die gemessene Versorgungsspannung ersetzen
  Serial.print("uBat= ");
  Serial.println(uBat);
  if(uBat>4.1) reichweite = 100;
  if(uBat<4.1 && uBat>4.0) reichweite =75;
  if(uBat<4.0 && uBat>3.9) reichweite =50;
  if(uBat<3.9 && uBat>3.8) reichweite =25;
  if(uBat<3.8 && uBat>3.6) reichweite =0;
  //usw
  Serial.print ("reichweite");
  Serial.println (reichweite);
  

//----------------------------Temperaturüberwachung  ------------------------------------------

sensorwertMotor=analogRead(regler); //Auslesen des Sensorwertes.
sensorwertAkku=analogRead(motor); //Auslesen des Sensorwertes.
sensorwertRegler=analogRead(akku); //Auslesen des Sensorwertes.
temperaturMotor= map(sensorwertMotor, 0, 410, -50, 150); //Umwandeln des Sensorwertes mit Hilfe des "map" Befehls.
temperaturRegler= map(sensorwertRegler, 0, 410, -50, 150); //Umwandeln des Sensorwertes mit Hilfe des "map" Befehls.
temperaturAkku= map(sensorwertAkku, 0, 410, -50, 150); //Umwandeln des Sensorwertes mit Hilfe des "map" Befehls.
delay(t); // Nach jeder Messung ist je eine kleine Pause mit der Dauer „t" in Millisekunden.

//---------------------------------------------------------------------------------------------

  return micros() - start;
}

soweit sogut wenn ich den die Zeile " return micros() - start;
} " raus lasse kann ich das programm auf das arduino hochladen ( Ergebniss siehe Foto )

Wenn ich aber die Zeile drin lasse kommt die Fehlermeldung " expected unqualified-id before 'return' "

das Problem ist, ich habe so ein Display nicht und kann daher nich Testen.
Du solltest dir für die Temperatur und Spannungsüberwachung eigene Funktionen schreiben und es nicht in die Funktion TestText mit reinpacken bzw. es in der Loop machen und alles überflüssige aus deinem Sketch rausschmeißen.

Dann werde ich das mal versuchen.

Danke für deine Bemühungen damit werde ich das Schiff bestimmt geschaukelt bekommen. :slight_smile:

ich habe nochmal ein wenig an deinem Sketch rumgebastelt, versuch mal ob es läuft

// IMPORTANT: Elegoo_TFTLCD LIBRARY MUST BE SPECIFICALLY
// CONFIGURED FOR EITHER THE TFT SHIELD OR THE BREAKOUT BOARD.
// SEE RELEVANT COMMENTS IN Elegoo_TFTLCD.h FOR SETUP.

#include <Elegoo_GFX.h>    // Core graphics library
#include <Elegoo_TFTLCD.h> // Hardware-specific library

// The control pins for the LCD can be assigned to any digital or
// analog pins...but we'll use the analog pins as this allows us to
// double up the pins with the touch screen (see the TFT paint example).
#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0

#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin

// When using the BREAKOUT BOARD only, use these 8 data lines to the LCD:
// For the Arduino Uno, Duemilanove, Diecimila, etc.:
//   D0 connects to digital pin 8  (Notice these are
//   D1 connects to digital pin 9   NOT in order!)
//   D2 connects to digital pin 2
//   D3 connects to digital pin 3
//   D4 connects to digital pin 4
//   D5 connects to digital pin 5
//   D6 connects to digital pin 6
//   D7 connects to digital pin 7
// For the Arduino Mega, use digital pins 22 through 29
// (on the 2-row header at the end of the board).

// Assign human-readable names to some common 16-bit color values:
#define BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF

Elegoo_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
// If using the shield, all control and data lines are fixed, and
// a simpler declaration can optionally be used:
// Elegoo_TFTLCD tft;

//----------------------------Spannungsüberwachung Lipo --------------------------------------
/*
 * Spannungsüberwachung einer Lipozelle
 * Lipozelle zwischen A10 und GND angeschlossen
 */
 const byte uBatPin=A10;
 float uBat;
 byte reichweite;
//---------------------------------------------------------------------------------------------

//----------------------------Temperaturüberwachung  ------------------------------------------
const byte regler = A11; //Der Sensor soll am analogen Pin A11 angeschlossen werden. Wir nennen den Pin ab jetzt "regler"
const byte motor = A12; //Der Sensor soll am analogen Pin A12 angeschlossen werden. Wir nennen den Pin ab jetzt "motor"
const byte akku = A13; //Der Sensor soll am analogen Pin A0 angeschlossen werden. Wir nennen den Pin ab jetzt "akku"
int sensorwertMotor;
int sensorwertRegler;
int sensorwertAkku;
int temperaturMotor = 0; //Unter der Variablen "temperatur" wird später der Temperaturwert abgespeichert.
int temperaturRegler = 1; //Unter der Variablen "temperatur" wird später der Temperaturwert abgespeichert.
int temperaturAkku = 2; //Unter der Variablen "temperatur" wird später der Temperaturwert abgespeichert.

//---------------------------------------------------------------------------------------------
void setup(void) {
  Serial.begin(9600);
  //Serial.println(F("TFT LCD test"));


#ifdef USE_Elegoo_SHIELD_PINOUT
  Serial.println(F("Using Elegoo 2.8\" TFT Arduino Shield Pinout"));
#else
  Serial.println(F("Using Elegoo 2.8\" TFT Breakout Board Pinout"));
#endif

  Serial.print("TFT size is "); Serial.print(tft.width()); Serial.print("x"); Serial.println(tft.height());

  tft.reset();

  uint16_t identifier = tft.readID();
     identifier=0x9341;
  if(identifier == 0x9325) {
    Serial.println(F("Found ILI9325 LCD driver"));
  } else if(identifier == 0x9328) {
   Serial.println(F("Found ILI9328 LCD driver"));
  } else if(identifier == 0x7575) {
    Serial.println(F("Found HX8347G LCD driver"));
  } else if(identifier == 0x9341) {
    Serial.println(F("Found ILI9341 LCD driver"));
  } else if(identifier == 0x8357) {
    Serial.println(F("Found HX8357D LCD driver"));
  } else {
    Serial.print(F("Unknown LCD driver chip: "));
    Serial.println(identifier, HEX);
    Serial.println(F("If using the Elegoo 2.8\" TFT Arduino shield, the line:"));
    Serial.println(F("  #define USE_Elegoo_SHIELD_PINOUT"));
    Serial.println(F("should appear in the library header (Elegoo_TFT.h)."));
    Serial.println(F("If using the breakout board, it should NOT be #defined!"));
    Serial.println(F("Also if using the breakout, double-check that all wiring"));
    Serial.println(F("matches the tutorial."));
    return;
  }

  tft.begin(identifier);

  Serial.println(F("Done!"));
  tft.setRotation(3);
  tft.setCursor(0, 0); 
  tft.setTextColor(WHITE);
  tft.setTextSize(3);
  tft.println("Regler Temp.");
  tft.println("");
  tft.println("Motor  Temp.");
  tft.println("");
  tft.println("Akku  Temp.");
  tft.println("");
  tft.println("Reichweite");
  tft.println("");
  tft.setCursor(270, 145);
  tft.setTextColor(WHITE);
  tft.println("KM");
  //----------------------------Spannungsüberwachung Lipo --------------------------------------
  tft.setTextColor(GREEN);
  tft.setCursor(200, 200);
  tft.println("V");
  tft.setCursor(0, 200);
  tft.println("Akku-Zelle"); 

}

void loop(void) {
    Batterie();
    Temperatur();
    static uint32_t startzeit;
   
    if(millis()-startzeit>1000
    {ausgabeTemperatur();
     ausgabeSpannung();
     startzeit = millis();
    }
  }
 
//----------------------------Temperaturüberwachung  ------------------------------------------
  void ausgabeTemperatur()
  {
  tft.setTextColor(GREEN);
  tft.setCursor(270, 0);
  tft.println(temperaturRegler);
  tft.setCursor(270, 50);
  tft.println(temperaturMotor);
  tft.setCursor(270, 100);
  tft.println(temperaturAkku);
  }

//---------------------------------------------------------------------------------------------
  void ausgabeSpannung()
  {
  tft.setTextColor(WHITE);
  tft.setCursor(250, 145);
  tft.println(reichweite);  
  tft.println(uBat);
  tft.setCursor(280, 200);
  
  }

//----------------------------Spannungsüberwachung Lipo --------------------------------------
  void Batterie()
  {
  uBat = analogRead(uBatPin)*4.2/1024;// 4.2ch die gemessene Versorgungsspannung ersetzen
  Serial.print("uBat= ");
  Serial.println(uBat);
  if(uBat>4.1) reichweite = 100;
  if(uBat<4.1 && uBat>4.0) reichweite =75;
  if(uBat<4.0 && uBat>3.9) reichweite =50;
  if(uBat<3.9 && uBat>3.8) reichweite =25;
  if(uBat<3.8 && uBat>3.6) reichweite =0;
 
  Serial.println (reichweite);
  Serial.print (reichweite);
  }

//----------------------------Temperaturüberwachung  ------------------------------------------
void Temperatur()
{
sensorwertMotor=analogRead(regler); //Auslesen des Sensorwertes.
sensorwertAkku=analogRead(motor); //Auslesen des Sensorwertes.
sensorwertRegler=analogRead(akku); //Auslesen des Sensorwertes.
temperaturMotor= map(sensorwertMotor, 0, 410, -50, 150); //Umwandeln des Sensorwertes mit Hilfe des "map" Befehls.
temperaturRegler= map(sensorwertRegler, 0, 410, -50, 150); //Umwandeln des Sensorwertes mit Hilfe des "map" Befehls.
temperaturAkku= map(sensorwertAkku, 0, 410, -50, 150); //Umwandeln des Sensorwertes mit Hilfe des "map" Befehls.
}
//---------------------------------------------------------------------------------------------

Hey!

habe den Sketch gerade mal drauf gezogen und was soll ich sagen auf dem seriellen Monitor macht die Volt-anzeige und die Reichweiten anzeige was sie soll :D.

Die Temperaturen werden am Seriellen Monitor nicht ausgegeben.

Auf dem TFT überschreibt er alle Werte bis man nix mehr erkennt.

Aber das sollte ja kein so großes Problem mehr sein glaube ich :slight_smile: .
Da werde ich Morgen mal gucken nach gucken.

Das hat mir wieder mal sehr weiter geholfen :slight_smile: .

Danke.