#include <TFT_eSPI.h>
#include <WiFi.h>
#include "time.h"
TFT_eSPI tft = TFT_eSPI();
TFT_eSprite stext = TFT_eSprite(&tft);
const char* ssid = "****";
const char* password = "****+";
const char* ntpServer = "de.pool.ntp.org";
const char* TZ_INFO = "CET-1CEST,M3.5.0/02,M10.5.0/03";
int m;
int ten_m;
int h;
int ten_h;
//String stringOne = String('datumString');
String stringOne = String("datumString");
void setup() {
tft.init();
tft.fillScreen(TFT_BLACK);
tft.setRotation(3);
stext.setColorDepth(8);
stext.createSprite(320, 26);
stext.fillSprite(TFT_BLACK);
stext.setScrollRect(0, 0, 320, 26, TFT_BLACK);
stext.setTextColor(TFT_WHITE);
Serial.begin(115200);
Serial.print("Connecting to ");
configTzTime(TZ_INFO, ntpServer);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print("."); }
Serial.println("");
Serial.println("WiFi connected.");
// Init and get the time
// configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
printLocalTime();
}
int x = 80;
void loop() {
tft.setRotation(3);
//delay(500);
printLocalTime();
static int tcount = 0;
stext.pushSprite(0, 0);
delay(25);
stext.scroll(1, 0);
tcount--;
if (tcount <= 0) {
tcount = 320;
tft.setRotation(3);
stext.drawString(stringOne, 0, 0, 4);
}
}
void printLocalTime() {
struct tm timeinfo;
if (!getLocalTime(&timeinfo)) {
Serial.println("Failed to obtain time");
return;
}
Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S");
Serial.print("Day of week: ");
Serial.println(&timeinfo, "%A");
Serial.print("Month: ");
Serial.println(&timeinfo, "%B");
Serial.print("Day of Month: ");
Serial.println(&timeinfo, "%d");
Serial.print("Year: ");
Serial.println(&timeinfo, "%Y");
Serial.print("Hour: ");
Serial.println(&timeinfo, "%H");
Serial.print("Hour (12 hour format): ");
Serial.println(&timeinfo, "%I");
Serial.print("Minute: ");
Serial.println(&timeinfo, "%M");
Serial.print("Second: ");
Serial.println(&timeinfo, "%S");
char datumString[50];
strftime(datumString, 50, "%A, den %d. %B .%Y" , &timeinfo);
Serial.println(datumString);
//strftime(datumString, 50, "%A, den %d. %B" , &timeinfo);
uint8_t ten_h = '0' + (timeinfo.tm_hour / 10);
uint8_t h = '0' + (timeinfo.tm_hour % 10);
uint8_t ten_m = '0' + (timeinfo.tm_min / 10);
uint8_t m = '0' + (timeinfo.tm_min % 10);
tft.setRotation(3);
SegmentWrite(0, ten_h);
SegmentWrite(1, h);
SegmentWrite(2, ten_m);
SegmentWrite(3, m);
Serial.println(m);
Serial.println(ten_m);
Serial.println(h);
Serial.println(ten_h);
}
void SegmentWrite(uint8_t idx, char Element) {
if (idx == 0) { x = 00; }
if (idx == 1) { x = 80; }
if (idx == 2) { x = 160; }
if (idx == 3) { x = 240; }
//Serial.print("Segmentwrite ");
// Serial.print(idx);
// Serial.print(Element);
if ('b' == Element) {
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_BLACK); //A
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED); //G
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED); //D
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_BLACK); //B
tft.setRotation(3);
}
if ('o' == Element) {
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_BLACK); //A
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED); //G
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED); //D
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_RED); //E
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED); //C
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_BLACK); //B
tft.setRotation(3);
}
if ('0' == Element) {
tft.setRotation(3);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_BLACK);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED);
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
}
if ('1' == Element) {
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_BLACK);
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_BLACK);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_BLACK);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_BLACK);
tft.setRotation(2);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
}
if ('2' == Element) {
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED);
}
if ('3' == Element) {
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED);
}
if ('4' == Element) {
tft.setRotation(3);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_BLACK);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_BLACK);
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
}
if ('5' == Element) {
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_BLACK);
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED);
}
if ('6' == Element) {
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_BLACK);
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED);
}
if ('7' == Element) {
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_BLACK);
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_BLACK);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_BLACK);
tft.setRotation(2);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
}
if ('8' == Element) {
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED);
}
if ('9' == Element) {
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 65, 15, 7, TFT_BLACK);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED);
}
}
void Punkterot() {
tft.setRotation(1);
tft.fillCircle(156, 80, 5, TFT_RED);
tft.fillCircle(156, 120, 5, TFT_RED);
}
void Punktesw() {
tft.setRotation(1);
tft.fillCircle(156, 80, 5, TFT_BLACK);
tft.fillCircle(156, 120, 5, TFT_BLACK);
}
void AnzeigeInit() {
delay(500);
tft.init();
tft.fillScreen(TFT_BLACK);
delay(500);
}
Ist das eine andere Frage als dein anderes, aufgegebenes Thema? Laufband IDEASPARK esp32 1.9 inch -LCD
Ja
Habe das Programm umgestellt von Adafruit auf TFT_eSPI
GruĂ
Im englischen Teil des Forum mĂŒssen die BeitrĂ€ge und Diskussionen in englischer Sprache verfasst werden. Deswegen wurde diese Diskussion in den deutschen Teil des Forums verschoben.
mfg ein Moderator.
Hallo,
verkommt das Internet immer mehr zu solchen hingerotzten BeitrÀgen? Kein Schwein weià was los ist. Es gibt nicht einmal den Versuch einer gewissen Etikette. Man oh man.
Nicht aufregen, einfach den TO ignorieren.
GruĂ Tommy
Mach mall die unnötige Pausen weg, unnötigen Leerzeilen, so kann man das nicht lesen
Du meinst sicherlich die unnötigen Leerzeilen?
GruĂ Tommy
Jo genau Danke ;)
Das ist dein Laufband, und hier wird er angezeigt
if (tcount <= 0) {
tcount = 320;
tft.setRotation(3);
stext.drawString(stringOne, 0, 0, 4);
}
Da sieht es gut aus und im Laufband kommen nur Zahlen(keine Ahnung)
stext.drawString(stringOne, 0, 0, 4); da scheint der Fehler zu sein
String stringOne = "Hello String"; // using a constant StringString stringOne = "Hello String"; // using a constant String
String stringOne = String('a'); // converting a constant char into a String
String stringTwo = String("This is a string"); // converting a constant string into a String object
String stringOne = String(stringTwo + " with more"); // concatenating two strings
String stringOne = String(13); // using a constant integer
String stringOne = String(analogRead(0), DEC); // using an int and a base
String stringOne = String(45, HEX); // using an int and a base (hexadecimal)
String stringOne = String(255, BIN); // using an int and a base (binary)
String stringOne = String(millis(), DEC); // using a long and a base
String stringOne = String(5.698, 3); // using a float and the decimal places
Habe es nicht getestet, nur gezeigt wo der Fehler liegt.
ist ja dein Datum String.
Verstehe nicht die Spielerei mit der Rotation, was soll das bewirken ?
Anders gefragt was hast vor?
Zuerst war die Uhr
mein Vorhaben ist das Datum per Laufband einzublenden.
SpÀter hinzu sollen andere Daten wie Temp oder Wetterdaten.
mein Problem ist grad das ich es nicht verstehe warum das nicht funktioniert.
Ist das der Aufbau vom String Ich weiĂ nicht wo ich ansetzen soll .
GruĂ
[quote="kal-lan, post:13, topic:1444691"]
mein Problem ist grad das ich es nicht verstehe warum das nicht funktioniert.
Ist das der Aufbau vom String Ich weiĂ nicht wo ich ansetzen soll .
#include <TFT_eSPI.h>
#include <WiFi.h>
#include "time.h"
TFT_eSPI tft = TFT_eSPI();
TFT_eSprite stext = TFT_eSprite(&tft);
const char* ssid = "xx";
const char* password = "xxx";
const char* ntpServer = "de.pool.ntp.org";
const char* TZ_INFO = "CET-1CEST,M3.5.0/02,M10.5.0/03";
int m;
int ten_m;
int h;
int ten_h;
//String stringOne = String('datumString');
String stringOne = String("datumString");
void setup() {
tft.init();
tft.fillScreen(TFT_BLACK);
tft.setRotation(3);
stext.setColorDepth(8);
stext.createSprite(320, 26);
stext.fillSprite(TFT_BLACK);
stext.setScrollRect(0, 0, 320, 26, TFT_BLACK);
stext.setTextColor(TFT_WHITE);
Serial.begin(115200);
Serial.print("Connecting to ");
configTzTime(TZ_INFO, ntpServer);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print("."); }
Serial.println("");
Serial.println("WiFi connected.");
// Init and get the time
// configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
printLocalTime();
}
int x = 80;
void loop() {
// tft.setRotation(3);
//delay(500);
printLocalTime();
/* static int tcount = 0;
stext.pushSprite(0, 0);
delay(25);
stext.scroll(1, 0);
tcount--;
if (tcount <= 0) {
tcount = 320;
tft.setRotation(3);
stext.drawString(stringOne, 0, 0, 4);
}
*/
}
void printLocalTime() {
struct tm timeinfo;
if (!getLocalTime(&timeinfo)) {
Serial.println("Failed to obtain time");
return;
}
Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S");
Serial.print("Day of week: ");
Serial.println(&timeinfo, "%A");
Serial.print("Month: ");
Serial.println(&timeinfo, "%B");
Serial.print("Day of Month: ");
Serial.println(&timeinfo, "%d");
Serial.print("Year: ");
Serial.println(&timeinfo, "%Y");
Serial.print("Hour: ");
Serial.println(&timeinfo, "%H");
Serial.print("Hour (12 hour format): ");
Serial.println(&timeinfo, "%I");
Serial.print("Minute: ");
Serial.println(&timeinfo, "%M");
Serial.print("Second: ");
Serial.println(&timeinfo, "%S");
char datumString[50];
strftime(datumString, 50, "%A, den %d. %B .%Y" , &timeinfo);
Serial.println(datumString);
//strftime(datumString, 50, "%A, den %d. %B" , &timeinfo);
static int tcount = 0;
stext.pushSprite(0, 0);
delay(25);
stext.scroll(1, 0);
tcount--;
if (tcount <= 0) {
tcount = 320;
tft.setRotation(3);
stext.drawString(datumString, 0, 0, 4);
}
uint8_t ten_h = '0' + (timeinfo.tm_hour / 10);
uint8_t h = '0' + (timeinfo.tm_hour % 10);
uint8_t ten_m = '0' + (timeinfo.tm_min / 10);
uint8_t m = '0' + (timeinfo.tm_min % 10);
tft.setRotation(3);
SegmentWrite(0, ten_h);
SegmentWrite(1, h);
SegmentWrite(2, ten_m);
SegmentWrite(3, m);
Serial.println(m);
Serial.println(ten_m);
Serial.println(h);
Serial.println(ten_h);
}
void SegmentWrite(uint8_t idx, char Element) {
if (idx == 0) { x = 00; }
if (idx == 1) { x = 80; }
if (idx == 2) { x = 160; }
if (idx == 3) { x = 240; }
//Serial.print("Segmentwrite ");
// Serial.print(idx);
// Serial.print(Element);
if ('b' == Element) {
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_BLACK); //A
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED); //G
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED); //D
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_BLACK); //B
tft.setRotation(3);
}
if ('o' == Element) {
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_BLACK); //A
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED); //G
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED); //D
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_RED); //E
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED); //C
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_BLACK); //B
tft.setRotation(3);
}
if ('0' == Element) {
tft.setRotation(3);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_BLACK);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED);
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
}
if ('1' == Element) {
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_BLACK);
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_BLACK);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_BLACK);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_BLACK);
tft.setRotation(2);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
}
if ('2' == Element) {
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED);
}
if ('3' == Element) {
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED);
}
if ('4' == Element) {
tft.setRotation(3);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_BLACK);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_BLACK);
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
}
if ('5' == Element) {
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_BLACK);
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED);
}
if ('6' == Element) {
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_BLACK);
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED);
}
if ('7' == Element) {
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_BLACK);
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_BLACK);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_BLACK);
tft.setRotation(2);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
}
if ('8' == Element) {
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED);
}
if ('9' == Element) {
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 65, 15, 7, TFT_BLACK);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED);
}
}
void Punkterot() {
tft.setRotation(1);
tft.fillCircle(156, 80, 5, TFT_RED);
tft.fillCircle(156, 120, 5, TFT_RED);
}
void Punktesw() {
tft.setRotation(1);
tft.fillCircle(156, 80, 5, TFT_BLACK);
tft.fillCircle(156, 120, 5, TFT_BLACK);
}
void AnzeigeInit() {
delay(500);
tft.init();
tft.fillScreen(TFT_BLACK);
delay(500);
}
und wenn du noch mall kommst mit so Formatierten Sketch dann kannst das alles vergessen, genau geht es um die Leerzeilen,
Dan baue dir eine Wetterstation hast ja ein Display mit min 240 x320 Pixel oder versucht das alles auf dem 1,9" Display?
Dan wird das alles wo möglich nicht funktionieren wie es soll
Ich möchte mich bedanken .
da ich das als Hobby betreibe bin ich fĂŒr mich froh dass ich das soweit verstehe.
GruĂ
Schreibt dir alles auf Englisch, um Deutsch haben musst mit Array() arbeiten, und den Text, String mit snprintf() bauen
sag mal, warum wird denn beim fĂŒllen der Zellen stĂ€ndig rotiert und warum nochmal das rotieren am SchluĂ?
Was da was in der Funktionsparametern ist, muss ich mir erarbeiten.
Das letzte ist die Farbe :-) ![]()
ich auch und sogar nicht so lange, erst als Rentner wurde.
Auf die frage was soll das ab Zeile 144 warte auf Antwort, so wie was fĂŒr Display wird genutzt.
void SegmentWrite(uint8_t idx, char Element) {
if (idx == 0) { x = 00; }
if (idx == 1) { x = 80; }
if (idx == 2) { x = 160; }
if (idx == 3) { x = 240; }
//Serial.print("Segmentwrite ");
// Serial.print(idx);
// Serial.print(Element);
if ('b' == Element) {
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_BLACK); //A
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED); //G
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED); //D
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_BLACK); //B
tft.setRotation(3);
}
if ('o' == Element) {
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_BLACK); //A
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED); //G
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED); //D
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_RED); //E
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED); //C
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_BLACK); //B
tft.setRotation(3);
}
if ('0' == Element) {
tft.setRotation(3);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_BLACK);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED);
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
}
if ('1' == Element) {
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_BLACK);
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_BLACK);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_BLACK);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_BLACK);
tft.setRotation(2);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
}
if ('2' == Element) {
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED);
}
if ('3' == Element) {
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED);
}
if ('4' == Element) {
tft.setRotation(3);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_BLACK);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_BLACK);
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_RED);
tft.setRotation(3);
}
if ('5' == Element) {
tft.setRotation(2);
tft.fillRoundRect(15, x + 10, 45, 15, 7, TFT_BLACK);
tft.fillRoundRect(15, x + 40, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 10, 45, 15, 7, TFT_RED);
tft.fillRoundRect(65, x + 40, 45, 15, 7, TFT_BLACK);
tft.setRotation(3);
tft.fillRoundRect(x + 15, 50, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 100, 35, 15, 7, TFT_RED);
tft.fillRoundRect(x + 15, 150, 35, 15, 7, TFT_RED);
}
Dass frage mich auch, habe nur den Scrolltext gemacht, und glech geschrieben das dass alles ist Schrotthaufeen