Ok alles klar
Habe was gebaut, hat ein wenig Zeit gekostet mit vielen Unterbrechungen, so ist das eben im Leben
Gut das mir so was Spaß macht ![]()
In der Mitte zwischen Symbol und °C ist genügend Platz für die Temp Werte.
Wegen der Kleiner Schrift auf der Skala habe eine von meinen genommen.
Die Out Temp ist nur so drauf geklatscht nur damit man hat Übersicht.
ES ist nur die Grundzeichnung! nix mehr, wenn das so ist iO. dann bauen wir weiter.
Den Code, wenn alles Funktioniert muss noch bereinigen, von schön ist er weit weg, aber tuts was soll, jeder macht eben wie er kann.
#define AA_FONT_middle "Lato-Regular-28" //
#define AA_FONT_klein "NotoSans-Black-15"
#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // https://github.com/Bodmer/TFT_eSPI
TFT_eSPI tft = TFT_eSPI();
#include "SPIFFS.h"
#include "GfxUi.h"
GfxUi ui = GfxUi(&tft); // Jpeg and bmpDraw functions TODO: pull outside of a class
#include "max6675.h"
// Define the Arduino pins, the MAX6675 module is connected to
const int SO_PIN = 17; // Serail Out (SO) pin
const int CS_PIN = 2; // Chip Select (CS) pin
const int SCK_PIN = 14; // Clock (SCK) pin
// Create an instance of the MAX6675 class with the specified pins
MAX6675 thermocouple(14, 2, 17);
/*******Display Grösse***********/
const int tftBreite = 239; //319; // x
const int tftHoehe = 319; //239 // y
/********Balken + Rahmen für Wasser *****/
const int pos_X = 10;
const int pos_Y = tftHoehe * 0.333;
const int pos_Y1 = tftHoehe * 0.666 - 10 ;
const int breite_H = 20; // Höhe = Dicke vom Balken
const int laenge_W = tftBreite - pos_X * 2; //Länge
const int tem_Min_Wasser = 0;
const int tem_Max_Wasser = 120;
/********balken Rechts Wasser *****/
const int pos_X2 = 10 + 160;
//const int pos_Y2 = 201;
void setup() {
Serial.begin(9600);
delay(500);
SPIFFS.begin();
tft.begin();
tft.setRotation(0);
tft.fillScreen(TFT_BLACK);
ui.drawJpeg("/logo.jpg", 2, 100);
delay(1000);// Zeitlänge für Logo
tft.fillScreen(TFT_BLACK);
tft.loadFont( AA_FONT_middle );
//tft.setTextPadding(tft.textWidth("555.5"));
tft.setTextColor(TFT_WHITE, TFT_BLACK);
/*********************************************/
tft.drawString("Out 25.5 °C", 10, 15); // text, x pos, y pos
/*********Trennlinie ********/
tft.drawFastHLine(pos_X, tftHoehe - laenge_W - 50, tftBreite - 20, TFT_ORANGE); //x, y, w,color
ui.drawJpeg("/wasser_temp_2.jpg", 0, 62);// Symbol zeichnen
/*********** Rahmen Waaser **************/
tft.drawRect(pos_X - 1, pos_Y1 - breite_H - 60, laenge_W + 2, breite_H + 4, TFT_WHITE); // x y w h color
/*********** Rahmen Öl *******************/
tft.drawRect(pos_X - 1, tftHoehe - 70, laenge_W + 2 , breite_H + 4, TFT_WHITE);
/******* Skala beide Balken mit Beschriftung ******/
byte skala = (tftBreite - 20) / 6;
tft.loadFont( AA_FONT_klein );
byte j = 0;
byte k = 0;
//tft.drawFastVLine(pos_X - 1, pos_Y1 - breite_H - 60 + 22 , 20, TFT_WHITE);
for (byte i = 0; i <= 5; i++) {
j = i * skala;
tft.drawFastVLine(pos_X - 1 + j, pos_Y1 - breite_H - 60 + 23 , 20, TFT_WHITE);
tft.setCursor(j, pos_Y1 - breite_H - 60 + 43);
tft.print(k );
tft.drawFastVLine(pos_X - 1 + j, tftHoehe - 47, 20, TFT_WHITE);
tft.setCursor(j, tftHoehe - 25);
tft.print(k );
k = k + 20;
}
tft.fillRect(0, 150, 30, 50, TFT_BLACK);
tft.fillRect(0, 280, 30, 50, TFT_BLACK);
tft.drawFastVLine(pos_X - 1 , pos_Y1 - breite_H - 60 + 23 , 20, TFT_BLACK);
tft.drawFastVLine(pos_X - 1 , tftHoehe - 47, 20, TFT_BLACK);
//tft.drawFastVLine(tftBreite - 10, pos_Y1 - breite_H - 60 + 23 , 20, TFT_WHITE);
tft.setCursor(tftBreite - 24, pos_Y1 - breite_H - 60 + 43);
tft.print("°C");
//tft.drawFastVLine(tftBreite - 10, tftHoehe - 47 , 20, TFT_WHITE);
tft.setCursor(tftBreite - 24, tftHoehe - 27);
tft.print("°C");
/*********Trennlinie ********/
tft.drawFastHLine(pos_X, tftHoehe / 2 + 30, tftBreite - 20, TFT_ORANGE); //x, y, w,color
ui.drawJpeg("/oelkanne.jpg", 0, tftHoehe / 2 + 45);
tft.loadFont( AA_FONT_middle );
tft.drawString("°C", tftBreite - 40, tftHoehe - 246); // text, x pos, y pos
tft.drawString("°C", tftBreite - 40, tftHoehe - 110);
}
void loop() {
// Read the temperature in Celsius
/*Serial.print("Temperature: ");
Serial.print(thermocouple.readCelsius());
Serial.print("\xC2\xB0"); // shows degree symbol
*/
//Serial.print("C | ");
delay(500);
tft.setCursor(36, 30);
tft.setTextColor(TFT_YELLOW, TFT_BLACK);
float temp = thermocouple.readCelsius();
//tft.setTextSize(3);
// tft.print(temp, 1);
/*********ab hier die Berechnung ************/
int temp1 = thermocouple.readCelsius();
/******* Koordinaten Position x,y,h,w**********
********* Min Temp, Max Temp********************
***********************************************/
/*************Außenrahmen zeichnen****************/
// Umrechnung //
int balkenR = map(temp1, tem_Min_Wasser, tem_Max_Wasser, 0, laenge_W);
int balkenL = map(temp1, tem_Min_Wasser, tem_Max_Wasser, laenge_W, 0);
// Sichtbare Balken
// tft.fillRect(pos_X, pos_Y, balkenR, breite_H, TFT_RED); //x y w h Color
// Löschen wen Balkenwert wird Kleiner
// tft.fillRect(pos_X + balkenR, pos_Y, balkenL , breite_H, TFT_BLACK); //x y w h Color
// ui.drawJpeg("/wasser_temp_2.jpg", 10, 150);
//ui.drawJpeg("/oelkanne.jpg", 161, 150);
tft.setTextDatum(TL_DATUM); // Reset datum to normal
tft.setTextPadding(0); // Breite der Füllung auf keine zurücksetzen
tft.unloadFont();
}
Hatte heute wieder zeit um es zu testen. Ich danke dir gefällt mir so
Sorry falsche Schriftart ![]()
Das ist die Schrift was nutze für Skal.
Muss man aber nicht zwingend nutzen, die Größe ist 15 Punkte.
NotoSans-Black-15.zip (9.3 KB)
Gut dann muss die Balken anpassen die Funktionieren jetzt nicht mehr, genauer sind an falscher Stelle.
Okay
So, jetzt sollte erst die Out Temp (DS18B20) vernünftig angezeigt werden, teste das Bitte und sag Bescheid
#define AA_FONT_middle "Lato-Regular-28" //
#define AA_FONT_klein "NotoSans-Black-15"
#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // https://github.com/Bodmer/TFT_eSPI
TFT_eSPI tft = TFT_eSPI();
/********* DS18B20 *****************/
#include <DallasTemperature.h>
#include <OneWire.h>
#define ONE_WIRE_BUS 25
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
/*************************************/
#include "SPIFFS.h"
#include "GfxUi.h"
GfxUi ui = GfxUi(&tft); // Jpeg and bmpDraw functions TODO: pull outside of a class
#include "max6675.h"
// Define the Arduino pins, the MAX6675 module is connected to
const int SO_PIN = 17; // Serail Out (SO) pin
const int CS_PIN = 2; // Chip Select (CS) pin
const int SCK_PIN = 14; // Clock (SCK) pin
// Create an instance of the MAX6675 class with the specified pins
MAX6675 thermocouple(14, 2, 17);
/*******Display Grösse***********/
const int tftBreite = 239; //319; // x
const int tftHoehe = 319; //239 // y
/********Balken + Rahmen für Wasser *****/
const int pos_X = 10;
const int pos_Y = tftHoehe * 0.333;
const int pos_Y1 = tftHoehe * 0.666 - 10 ;
const int breite_H = 20; // Höhe = Dicke vom Balken
const int laenge_W = tftBreite - pos_X * 2; //Länge
const int tem_Min_Wasser = 0;
const int tem_Max_Wasser = 120;
/********balken Rechts Wasser *****/
const int pos_X2 = 10 + 160;
//const int pos_Y2 = 201;
void setup() {
Serial.begin(9600);
delay(500);
SPIFFS.begin();
tft.begin();
tft.setRotation(0);
tft.fillScreen(TFT_BLACK);
ui.drawJpeg("/logo.jpg", 2, 100);
delay(1000);// Zeitlänge für Logo
tft.fillScreen(TFT_BLACK);
tft.loadFont( AA_FONT_middle );
//tft.setTextPadding(tft.textWidth("555.5"));
tft.setTextColor(TFT_WHITE, TFT_BLACK);
/*********************************************/
tft.drawString("Out", 10, 15); // text, x pos, y pos
tft.drawString("°C", tftBreite - 40, 15);
/*********Trennlinie ********/
tft.drawFastHLine(pos_X, tftHoehe - laenge_W - 50, tftBreite - 20, TFT_ORANGE); //x, y, w,color
ui.drawJpeg("/wasser_temp_2.jpg", 0, 62);// Symbol zeichnen
/*********** Rahmen Waaser **************/
tft.drawRect(pos_X - 1, pos_Y1 - breite_H - 60, laenge_W + 2, breite_H + 4, TFT_WHITE); // x y w h color
/*********** Rahmen Öl *******************/
tft.drawRect(pos_X - 1, tftHoehe - 70, laenge_W + 2 , breite_H + 4, TFT_WHITE);
/******* Skala beide Balken mit Beschriftung ******/
byte skala = (tftBreite - 20) / 6;
tft.loadFont( AA_FONT_klein );
byte j = 0;
byte k = 0;
//tft.drawFastVLine(pos_X - 1, pos_Y1 - breite_H - 60 + 22 , 20, TFT_WHITE);
for (byte i = 0; i <= 5; i++) {
j = i * skala;
tft.drawFastVLine(pos_X - 1 + j, pos_Y1 - breite_H - 60 + 23 , 20, TFT_WHITE);
tft.setCursor(j, pos_Y1 - breite_H - 60 + 43);
tft.print(k );
tft.drawFastVLine(pos_X - 1 + j, tftHoehe - 47, 20, TFT_WHITE);
tft.setCursor(j, tftHoehe - 25);
tft.print(k );
k = k + 20;
}
tft.fillRect(0, 150, 30, 50, TFT_BLACK);
tft.fillRect(0, 280, 30, 50, TFT_BLACK);
tft.drawFastVLine(pos_X - 1 , pos_Y1 - breite_H - 60 + 23 , 20, TFT_BLACK);
tft.drawFastVLine(pos_X - 1 , tftHoehe - 47, 20, TFT_BLACK);
//tft.drawFastVLine(tftBreite - 10, pos_Y1 - breite_H - 60 + 23 , 20, TFT_WHITE);
tft.setCursor(tftBreite - 24, pos_Y1 - breite_H - 60 + 43);
tft.print("°C");
//tft.drawFastVLine(tftBreite - 10, tftHoehe - 47 , 20, TFT_WHITE);
tft.setCursor(tftBreite - 24, tftHoehe - 27);
tft.print("°C");
/*********Trennlinie ********/
tft.drawFastHLine(pos_X, tftHoehe / 2 + 30, tftBreite - 20, TFT_ORANGE); //x, y, w,color
ui.drawJpeg("/oelkanne.jpg", 0, tftHoehe / 2 + 45);
tft.loadFont( AA_FONT_middle );
tft.drawString("°C", tftBreite - 40, tftHoehe - 246); // text, x pos, y pos
tft.drawString("°C", tftBreite - 40, tftHoehe - 110);
tft.setTextDatum(TL_DATUM); // Reset datum to normal
tft.setTextPadding(0); // Breite der Füllung auf keine zurücksetzen
tft.unloadFont();
}
void loop() {
/**********DS18B20 auslesen und anzeigen **********/
sensors.requestTemperatures(); // Read temperature
float temperatureC = sensors.getTempCByIndex(0); // Get temperature in Celsius
if (temperatureC = -127) temperatureC = 0; // Anzeige wen DS nicht funktioniert
// tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.loadFont( AA_FONT_middle );
tft.setTextPadding(200);
tft.setTextDatum(CL_DATUM); //
tft.setTextPadding(tft.textWidth("55.5"));// String width + margin
tft.drawFloat(temperatureC, 1, 110, 25); // Wert, Pos_x, Pos_y
/******************************************************/
tft.setTextDatum(TL_DATUM); // Reset datum to normal
tft.setTextPadding(0); // Breite der Füllung auf keine zurücksetzen
tft.unloadFont();
// Read the temperature in Celsius
Serial.print("Temperature: ");
Serial.print(thermocouple.readCelsius());
Serial.print("\xC2\xB0"); // shows degree symbol
//Serial.print("C | ");
delay(500);
tft.setCursor(36, 30);
tft.setTextColor(TFT_YELLOW, TFT_BLACK);
float temp = thermocouple.readCelsius();
//tft.setTextSize(3);
// tft.print(temp, 1);
/*********ab hier die Berechnung ************/
int temp1 = thermocouple.readCelsius();
/******* Koordinaten Position x,y,h,w**********
********* Min Temp, Max Temp********************
***********************************************/
/*************Außenrahmen zeichnen****************/
// Umrechnung //
int balkenR = map(temp1, tem_Min_Wasser, tem_Max_Wasser, 0, laenge_W);
int balkenL = map(temp1, tem_Min_Wasser, tem_Max_Wasser, laenge_W, 0);
// Sichtbare Balken
// tft.fillRect(pos_X, pos_Y, balkenR, breite_H, TFT_RED); //x y w h Color
// Löschen wen Balkenwert wird Kleiner
// tft.fillRect(pos_X + balkenR, pos_Y, balkenL , breite_H, TFT_BLACK); //x y w h Color
// ui.drawJpeg("/wasser_temp_2.jpg", 10, 150);
//ui.drawJpeg("/oelkanne.jpg", 161, 150);
tft.setTextDatum(TL_DATUM); // Reset datum to normal
tft.setTextPadding(0); // Breite der Füllung auf keine zurücksetzen
tft.unloadFont();
}
Leider nicht.
Habs jetzt aber.
#define AA_FONT_middle "Lato-Regular-28" //
#define AA_FONT_klein "NotoSans-Black-15"
#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // https://github.com/Bodmer/TFT_eSPI
TFT_eSPI tft = TFT_eSPI();
/********* DS18B20 *****************/
#include <DallasTemperature.h>
#include <OneWire.h>
#define ONE_WIRE_BUS 25
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
/*************************************/
#include "SPIFFS.h"
#include "GfxUi.h"
GfxUi ui = GfxUi(&tft); // Jpeg and bmpDraw functions TODO: pull outside of a class
#include "max6675.h"
// Define the Arduino pins, the MAX6675 module is connected to
const int SO_PIN = 17; // Serail Out (SO) pin
const int CS_PIN = 2; // Chip Select (CS) pin
const int SCK_PIN = 14; // Clock (SCK) pin
// Create an instance of the MAX6675 class with the specified pins
MAX6675 thermocouple(14, 2, 17);
/*******Display Grösse***********/
const int tftBreite = 239; //319; // x
const int tftHoehe = 319; //239 // y
/********Balken + Rahmen für Wasser *****/
const int pos_X = 10;
const int pos_Y = tftHoehe * 0.333;
const int pos_Y1 = tftHoehe * 0.666 - 10 ;
const int breite_H = 20; // Höhe = Dicke vom Balken
const int laenge_W = tftBreite - pos_X * 2; //Länge
const int tem_Min_Wasser = 0;
const int tem_Max_Wasser = 120;
/********balken Rechts Wasser *****/
const int pos_X2 = 10 + 160;
//const int pos_Y2 = 201;
void setup() {
Serial.begin(9600);
delay(500);
SPIFFS.begin();
tft.begin();
tft.setRotation(0);
tft.fillScreen(TFT_BLACK);
ui.drawJpeg("/logo.jpg", 2, 100);
delay(1000);// Zeitlänge für Logo
tft.fillScreen(TFT_BLACK);
tft.loadFont( AA_FONT_middle );
//tft.setTextPadding(tft.textWidth("555.5"));
tft.setTextColor(TFT_WHITE, TFT_BLACK);
/*********************************************/
tft.drawString("Out", 10, 15); // text, x pos, y pos
tft.drawString("°C", tftBreite - 40, 15);
/*********Trennlinie ********/
tft.drawFastHLine(pos_X, tftHoehe - laenge_W - 50, tftBreite - 20, TFT_ORANGE); //x, y, w,color
ui.drawJpeg("/wasser_temp_2.jpg", 0, 62);// Symbol zeichnen
/*********** Rahmen Waaser **************/
tft.drawRect(pos_X - 1, pos_Y1 - breite_H - 60, laenge_W + 2, breite_H + 4, TFT_WHITE); // x y w h color
/*********** Rahmen Öl *******************/
tft.drawRect(pos_X - 1, tftHoehe - 70, laenge_W + 2 , breite_H + 4, TFT_WHITE);
/******* Skala beide Balken mit Beschriftung ******/
byte skala = (tftBreite - 20) / 6;
tft.loadFont( AA_FONT_klein );
byte j = 0;
byte k = 0;
//tft.drawFastVLine(pos_X - 1, pos_Y1 - breite_H - 60 + 22 , 20, TFT_WHITE);
for (byte i = 0; i <= 5; i++) {
j = i * skala;
tft.drawFastVLine(pos_X - 1 + j, pos_Y1 - breite_H - 60 + 23 , 20, TFT_WHITE);
tft.setCursor(j, pos_Y1 - breite_H - 60 + 43);
tft.print(k );
tft.drawFastVLine(pos_X - 1 + j, tftHoehe - 47, 20, TFT_WHITE);
tft.setCursor(j, tftHoehe - 25);
tft.print(k );
k = k + 20;
}
tft.fillRect(0, 150, 30, 50, TFT_BLACK);
tft.fillRect(0, 280, 30, 50, TFT_BLACK);
tft.drawFastVLine(pos_X - 1 , pos_Y1 - breite_H - 60 + 23 , 20, TFT_BLACK);
tft.drawFastVLine(pos_X - 1 , tftHoehe - 47, 20, TFT_BLACK);
//tft.drawFastVLine(tftBreite - 10, pos_Y1 - breite_H - 60 + 23 , 20, TFT_WHITE);
tft.setCursor(tftBreite - 24, pos_Y1 - breite_H - 60 + 43);
tft.print("°C");
//tft.drawFastVLine(tftBreite - 10, tftHoehe - 47 , 20, TFT_WHITE);
tft.setCursor(tftBreite - 24, tftHoehe - 27);
tft.print("°C");
/*********Trennlinie ********/
tft.drawFastHLine(pos_X, tftHoehe / 2 + 30, tftBreite - 20, TFT_ORANGE); //x, y, w,color
ui.drawJpeg("/oelkanne.jpg", 0, tftHoehe / 2 + 45);
tft.loadFont( AA_FONT_middle );
tft.drawString("°C", tftBreite - 40, tftHoehe - 246); // text, x pos, y pos
tft.drawString("°C", tftBreite - 40, tftHoehe - 110);
tft.setTextDatum(TL_DATUM); // Reset datum to normal
tft.setTextPadding(0); // Breite der Füllung auf keine zurücksetzen
tft.unloadFont();
}
void loop() {
sensors.requestTemperatures(); // Read temperature
float temperatureC = sensors.getTempCByIndex(0); // Get temperature in Celsius
if (temperatureC < 0) temperatureC = 0; // Anzeige wen DS nicht funktioniert
tft.loadFont( AA_FONT_middle );
tft.setTextPadding(200);
tft.setTextDatum(CL_DATUM); //
tft.setTextPadding(tft.textWidth("55.5"));// String width + margin
tft.drawFloat(temperatureC, 1, 100, 25);
tft.setTextPadding(tft.textWidth("555.5"));// String width + margin
tft.setTextDatum(TL_DATUM); // Reset datum to normal
tft.setTextPadding(0); // Breite der Füllung auf keine zurücksetzen
tft.unloadFont();
tft.unloadFont();
// Read the temperature in Celsius
Serial.print("Temperature: ");
Serial.print(thermocouple.readCelsius());
Serial.print("\xC2\xB0"); // shows degree symbol
//Serial.print("C | ");
delay(500);
tft.setCursor(36, 30);
tft.setTextColor(TFT_YELLOW, TFT_BLACK);
float temp = thermocouple.readCelsius();
//tft.setTextSize(3);
//tft.print(temp, 1);
/*********ab hier die Berechnung ************/
int temp1 = thermocouple.readCelsius();
/******* Koordinaten Position x,y,h,w**********
********* Min Temp, Max Temp********************
***********************************************/
/*************Außenrahmen zeichnen****************/
// Umrechnung //
int balkenR = map(temp1, tem_Min_Wasser, tem_Max_Wasser, 0, laenge_W);
int balkenL = map(temp1, tem_Min_Wasser, tem_Max_Wasser, laenge_W, 0);
// Sichtbare Balken
// tft.fillRect(pos_X, pos_Y, balkenR, breite_H, TFT_RED); //x y w h Color
// Löschen wen Balkenwert wird Kleiner
// tft.fillRect(pos_X + balkenR, pos_Y, balkenL , breite_H, TFT_BLACK); //x y w h Color
// ui.drawJpeg("/wasser_temp_2.jpg", 10, 150);
//ui.drawJpeg("/oelkanne.jpg", 161, 150);
tft.setTextDatum(TL_DATUM); // Reset datum to normal
tft.setTextPadding(0); // Breite der Füllung auf keine zurücksetzen
tft.unloadFont();
}
Was habe vermasselt? bin unterwegs.
Habe Wasser Temp. fertig. Stelle später rein.
tft.drawFloat(temperatureC, 1, 100, 25); mit 100 überschreibst doch das "Out" 160 sollte schon sein. Ich schreibe von "rechts nach links", bedeutet die Nachkommastelle bleibt immer in der gleicher Stelle.
Habe den zweiten PT100 jetzt auch angeschlossen CS=12 und die anderen wie beim ersten.
OK dann teste das unten, wie nennst den zweiten PT ?
Habe beschien Zeit dann kann versuchen den auch fertig machen.
#define AA_FONT_middle "Lato-Regular-28" //
#define AA_FONT_klein "NotoSans-Black-15"
#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h> // https://github.com/Bodmer/TFT_eSPI
TFT_eSPI tft = TFT_eSPI();
/********* DS18B20 *****************/
#include <DallasTemperature.h>
#include <OneWire.h>
#define ONE_WIRE_BUS 25
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
/*************************************/
#include "SPIFFS.h"
#include "GfxUi.h"
GfxUi ui = GfxUi(&tft); // Jpeg and bmpDraw functions TODO: pull outside of a class
#include "max6675.h"
// Define the Arduino pins, the MAX6675 module is connected to
const int SO_PIN = 17; // Serail Out (SO) pin
const int CS_PIN = 2; // Chip Select (CS) pin
const int SCK_PIN = 14; // Clock (SCK) pin
// Create an instance of the MAX6675 class with the specified pins
MAX6675 thermocouple(14, 2, 17);
/*******Display Grösse***********/
const int tftBreite = 239; //319; // x
const int tftHoehe = 319; //239 // y
/********Balken + Rahmen für Wasser *****/
const int pos_X = 10;
const int pos_Y = tftHoehe * 0.333;
const int pos_Y1 = tftHoehe * 0.666 - 10 ;
const int breite_H = 20; // Höhe = Dicke vom Balken
const int laenge_W = tftBreite - pos_X * 2; //Länge
const int tem_Min_Wasser = 0;
const int tem_Max_Wasser = 120;
/********balken Rechts Wasser *****/
const int pos_X2 = 10 + 160;
//const int pos_Y2 = 201;
void setup() {
Serial.begin(9600);
delay(500);
SPIFFS.begin();
tft.begin();
tft.setRotation(0);
tft.fillScreen(TFT_BLACK);
ui.drawJpeg("/logo.jpg", 2, 100);
delay(1000);// Zeitlänge für Logo
tft.fillScreen(TFT_BLACK);
tft.loadFont( AA_FONT_middle );
//tft.setTextPadding(tft.textWidth("555.5"));
tft.setTextColor(TFT_WHITE, TFT_BLACK);
/*********************************************/
tft.drawString("Out", 10, 15); // text, x pos, y pos
tft.drawString("°C", tftBreite - 40, 15);
/*********Trennlinie ********/
tft.drawFastHLine(pos_X, tftHoehe - laenge_W - 50, tftBreite - 20, TFT_ORANGE); //x, y, w,color
ui.drawJpeg("/wasser_temp_2.jpg", 0, 62);// Symbol zeichnen
/*********** Rahmen Waaser **************/
tft.drawRect(pos_X - 1, pos_Y1 - breite_H - 60, laenge_W + 2, breite_H + 4, TFT_WHITE); // x y w h color
/*********** Rahmen Öl *******************/
tft.drawRect(pos_X - 1, tftHoehe - 70, laenge_W + 2 , breite_H + 4, TFT_WHITE);
/******* Skala beide Balken mit Beschriftung ******/
byte skala = (tftBreite - 20) / 6;
tft.loadFont( AA_FONT_klein );
byte j = 0;
byte k = 0;
//tft.drawFastVLine(pos_X - 1, pos_Y1 - breite_H - 60 + 22 , 20, TFT_WHITE);
for (byte i = 0; i <= 5; i++) {
j = i * skala;
tft.drawFastVLine(pos_X - 1 + j, pos_Y1 - breite_H - 60 + 23 , 20, TFT_WHITE);
tft.setCursor(j, pos_Y1 - breite_H - 60 + 43);
tft.print(k );
tft.drawFastVLine(pos_X - 1 + j, tftHoehe - 47, 20, TFT_WHITE);
tft.setCursor(j, tftHoehe - 25);
tft.print(k );
k = k + 20;
}
/******** Überschuss löschen *************
********* Null und erster Skalazeichen****
*******************************************/
tft.fillRect(0, 150, 30, 50, TFT_BLACK);
tft.fillRect(0, 280, 30, 50, TFT_BLACK);
tft.drawFastVLine(pos_X - 1, pos_Y1 - breite_H - 60 + 23 , 20, TFT_BLACK);
tft.drawFastVLine(pos_X - 1, tftHoehe - 47, 20, TFT_BLACK);
/**********************************************************/
tft.setCursor(tftBreite - 24, pos_Y1 - breite_H - 60 + 43);
tft.print("°C");
//tft.drawFastVLine(tftBreite - 10, tftHoehe - 47 , 20, TFT_WHITE);
tft.setCursor(tftBreite - 24, tftHoehe - 27);
tft.print("°C");
/*********Trennlinie ********/
tft.drawFastHLine(pos_X, tftHoehe / 2 + 30, tftBreite - 20, TFT_ORANGE); //x, y, w,color
ui.drawJpeg("/oelkanne.jpg", 0, tftHoehe / 2 + 45);
//******************** °C hinten Schreiben****************//
tft.loadFont( AA_FONT_middle );
tft.drawString("°C", tftBreite - 40, 15);
tft.drawString("°C", tftBreite - 40, tftHoehe - 246); // text, x pos, y pos
tft.drawString("°C", tftBreite - 40, tftHoehe - 110);
tft.setTextDatum(TL_DATUM); // Resett datum to normal
tft.setTextPadding(0); // Breite der Füllung auf keine zurücksetzen
tft.unloadFont(); //
}
void loop() {
/**********DS18B20 auslesen und anzeigen **********/
tft.setTextColor(TFT_YELLOW, TFT_BLACK);
tft.loadFont( AA_FONT_middle );
tft.setTextPadding(200);
tft.setTextDatum(CR_DATUM); // Rechts Bündig
tft.setTextPadding(tft.textWidth("55.5"));// String width + margin
sensors.requestTemperatures(); // Read temperature
float temperatureC = sensors.getTempCByIndex(0); // Get temperature in Celsius
if (temperatureC = -127) temperatureC = 0; // Anzeige wen DS nicht funktioniert
// tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.drawFloat(temperatureC, 1, 160, 27); // Wert, Pos_x, Pos_y
/******************************************************/
// Read the temperature in Celsius
Serial.print("Temperature: ");
Serial.print(thermocouple.readCelsius());
Serial.println("\xC2\xB0"); // shows degree symbol
//Serial.print("C | ");
tft.setCursor(36, 30);
tft.setTextColor(TFT_YELLOW, TFT_BLACK);
float temp_Wasser = thermocouple.readCelsius();
tft.drawFloat(temp_Wasser, 1, 160, pos_Y - 20); // Wert, Pos_x, Pos_y
/******* Koordinaten Position x,y,h,w**********
********* Min Temp, Max Temp********************
***********************************************/
byte temp_Wasser_Balken = (int)temp_Wasser ;
if (temp_Wasser_Balken <= 10)temp_Wasser_Balken = 10;
if (temp_Wasser_Balken >= 120)temp_Wasser = 120;
// Umrechnung Temperatur zu Displaybreite//
int balkenR = map(temp_Wasser_Balken , tem_Min_Wasser, tem_Max_Wasser, 0, laenge_W);
int balkenL = map(temp_Wasser_Balken , tem_Min_Wasser, tem_Max_Wasser, laenge_W, 0);
// Sichtbare Balken Temperaturwert
tft.fillRect(pos_X - 1 + 1, pos_Y + 19, balkenR, breite_H - 2, TFT_RED); //x y w h Color
// Löschen wen Temperaturwert wird Kleiner
tft.fillRect(pos_X + balkenR, pos_Y + 19, balkenL , breite_H - 2, TFT_BLACK); //x y w h Color
tft.setTextDatum(TL_DATUM); // Reset datum to normal
tft.setTextPadding(0); // Breite der Füllung auf keine zurücksetzen
tft.unloadFont();
}
Einfach 2 oder nicht
Also thermocouple2.readCelsius() ?
Du musst doch zweite Instanz bauen zB.
MAX6675 thermocouple2(a, b,c);
Ja thermocouple2.readCelsius()` ?
Dan teste mall beide mit Serial ob funktioniert = werden die Temperaturen angezeigt, ich kann das doch nicht testen
Zeige mall den Abschnitt bis Setup

