0

My Scoller is runnig Bad
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

My Scoller is runnig Bad

by sparfux on Mon Feb 11, 2019 9:29 am

Hello Feaks
here is my Hardware : Esp8266 Wifi NodeMCU Amica Board + 2,8 Zoll disply Red with SD Cards

Code: Select all | TOGGLE FULL SIZE
#include <ESP8266WiFi.h>
#include <time.h>
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#define TFT_DC D3
#define TFT_CS D1
//#define rst

#define BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF
// Copyright by chaoskasi
//const char* ssid = "Esu-ModellbahnWlan"; //# WLAN-User anpassen
const char* ssid = "Netzwerkerkennung-fehlgeschlagen"; //# WLAN-User anpassen
const char* pass = "pokerface2000"; //# WLAN-Passwort anpassen
int old_sec;
int h,m,s,ho,mo,so;
Adafruit_ILI9341 tft= Adafruit_ILI9341(TFT_CS, TFT_DC);
/////


int count = 0;
unsigned long previousMillis = 0;     // Speichern letzte zeit der anziege hat sich geändert
const long interval = 31500;          // interval zwischen änderungen (milliseconds)
int varianten = 7;    // / vari
 
// File myFile;
 
 char timeChar[100];
 char dateChar[50];
 
 //Fahrplan definieren Start
 char uhrzeit[][6]{ // [6] ist anzahl ziffern
 
  "00:12",//1
  "00:14",//2
  "04:48",//3
  "05:10",//4
  "05:28",//5
  "05:32",//6
  "06:15",//7
 
 
};
char zugnummer[][7]{// [7] ist anzahl charakteren
 
  "RE 761",//1
  "RB 336",//2
  "RE 841",//3
  "RB5760",//4
  "RE 59 ",//5
  "IC 760",//6
  "ICE223",//7
 
};
 
 
char ziel[][14]{// [11] ist anzahl charakteren
 
  "Warburg Hbf",//1
  "Hamm Hbf",//2
  "Paderborn",//3
  "Hamm Hbf",//4
  "Dortmund",//5
  "Lippstadt",//6
  "Soest Hbf", //7
 
 
 
 
};
 
char gleis[][2]{ //[2] ist anzahl charakteren
 
  "1",//1
  "3",//2
  "1",//3
  "2",//4
  "3",//5
  "1",//6
  "4",//7
 
 
};
 
  //Fahrplan definieren Ende
 
 
 String dateString;
 int minuteNow=0;
 int minutePrevious=0;

//   TEXT
//void testText(){
//  tft.fillScreen(ILI9341_BLACK); 
//  tft.setCursor(0, 0);
//  tft.setTextColor(ILI9341_WHITE);  tft.setTextSize(1);
//  tft.println("123456789012345678901234567890123456789");
//  tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2);
//  tft.println("1234567890123456789012345");
//  tft.setTextColor(ILI9341_RED);    tft.setTextSize(3);
//  tft.println(0xFEDCBA9, HEX);
//  tft.setTextColor(ILI9341_CYAN);    tft.setTextSize(4);
//  tft.println("ABCDEFGHIJKL");
//  tft.setTextColor(ILI9341_GREEN);  tft.setTextSize(5); 
//  tft.println("123456789");
//  tft.setTextColor(ILI9341_BLUE);  tft.setTextSize(6);
//  tft.println("ABCDEFG");
//  tft.setTextColor(ILI9341_MAGENTA);  tft.setTextSize(7);
//  tft.println("123456"); 
//  tft.setTextSize(3); 

//#define db_width 43
//#define db_height 30
PROGMEM const unsigned char db_bits[] = {
0xfc, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x03,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07,
   0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x47, 0x55, 0x00, 0x55, 0x01, 0x07,
   0xc7, 0xff, 0x81, 0xff, 0x07, 0x07, 0xc7, 0xff, 0x83, 0xff, 0x0f, 0x07,
   0xc7, 0xc7, 0x07, 0x8f, 0x0f, 0x07, 0xc7, 0x83, 0x8f, 0x07, 0x1f, 0x07,
   0xc7, 0x07, 0x8f, 0x0f, 0x1f, 0x07, 0xc7, 0x03, 0x8f, 0x07, 0x0f, 0x07,
   0xc7, 0x03, 0x9e, 0x0f, 0x0f, 0x07, 0xc7, 0x03, 0x9f, 0xff, 0x07, 0x07,
   0xc7, 0x07, 0x8e, 0xff, 0x03, 0x07, 0xc7, 0x03, 0x9f, 0xff, 0x07, 0x07,
   0xc7, 0x03, 0x9e, 0xaf, 0x0f, 0x07, 0xc7, 0x03, 0x8f, 0x0f, 0x1f, 0x07,
   0xc7, 0x07, 0x9f, 0x07, 0x1e, 0x07, 0xc7, 0x03, 0x8f, 0x0f, 0x1e, 0x07,
   0xc7, 0x83, 0x8f, 0x07, 0x1f, 0x07, 0xc7, 0xc7, 0x87, 0x0f, 0x1f, 0x07,
   0xc7, 0xff, 0x87, 0xff, 0x0f, 0x07, 0xc7, 0xff, 0x81, 0xff, 0x07, 0x07,
   0xc7, 0x5f, 0x00, 0x5f, 0x01, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07,
   0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0xdf, 0xfd, 0xb7, 0xfb, 0xee, 0x07,
   0xfe, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x01 };


// Anmeldung Wlan
void setup() {
  Serial.begin(115200);
  Serial.println("test");
  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
    }
  Serial.println("connected"); // Bestätigung für Wlan
  configTime(2*3600, 0, "0.de.pool.ntp.org"); // Online Zeit
  Serial.println("NTP ok");
 
  // Anfang Display
  tft.begin();
  tft.fillScreen(ILI9341_BLUE);
  tft.setRotation(1);
  ///// Scolllert
  tft.setTextWrap(false); // Text nicht in nächste Zeile umbrechen
  tft.setTextSize(2); // large letters
  ////////////////////////////////////////
  /// Abfahrt Text
  tft.fillRect(0,0,350,32,BLACK);
  tft.setTextColor(BLACK, WHITE); // Abfahr Schrift Farbe / hintergrundfarbe
  // tft.setCursor(100,5); // TEST größe vorne / höhe
  tft.setCursor(50,10);
  tft.setTextSize(2); // Text größe
  tft.print("Abfahrt/Departure");

  //tft.drawXBitmap(5, 10, myBitmap, 25, 20);
  //tft.drawBitmap(5, 5, myBitmap, 25, 20, RED);
  //tft.drawXBitmap(20, 80, db_bits, 50, 40, 0xFFFF);

 //tft.setTextSize(2);
 //tft.setCursor(35, 0);
 //tft.print("Abfahrt");
 
 //Zeile 1
 tft.setCursor(0, 35);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(uhrzeit[0]);
 
 tft.setCursor(65, 35);
 tft.setTextColor(BLUE, WHITE);
 tft.setTextSize(2);
 tft.print(zugnummer[0]);
 
 tft.setCursor(160, 35);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(ziel[0]);
 
 tft.setCursor(305, 35);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(gleis[0]);
 ///
 tft.fillRect(0,51,360,3,ILI9341_BLACK);
 //Zeile 2
 tft.setCursor(0, 55);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(uhrzeit[1]);
 
 tft.setCursor(65, 55);
 tft.setTextColor(BLUE, WHITE);
 tft.setTextSize(2);
 tft.print(zugnummer[1]);
 
 tft.setCursor(160, 55);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(ziel[1]);
 
 tft.setCursor(305, 55);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(gleis[1]);
 
 //
 tft.fillRect(0,71,360,3,ILI9341_BLACK);
 ///
 // Zeile 3
 tft.setCursor(0, 75);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(uhrzeit[2]);
 
 tft.setCursor(65, 75);
 tft.setTextColor(BLUE, WHITE);
 tft.setTextSize(2);
 tft.print(zugnummer[2]);
 
 tft.setCursor(160, 75);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(ziel[2]);
 
 tft.setCursor(305, 75);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(gleis[2]);
 //
 tft.fillRect(0,91,360,3,ILI9341_BLACK);
 ///
 //Zeile 4
 tft.setCursor(0, 95);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(uhrzeit[3]);
 
 tft.setCursor(65, 95);
 tft.setTextColor(BLUE, WHITE);
 tft.setTextSize(2);
 tft.print(zugnummer[3]);
 
 tft.setCursor(160, 95);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(ziel[1]);
 
 tft.setCursor(305, 95);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(gleis[3]);
 //
 tft.fillRect(0,111,360,3,ILI9341_BLACK);
 /// Zeile 5
 tft.setCursor(0, 115);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(uhrzeit[4]);
 
 tft.setCursor(65, 115);
 tft.setTextColor(BLUE, WHITE);
 tft.setTextSize(2);
 tft.print(zugnummer[6]);
 
 tft.setCursor(160, 115);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(ziel[4]);
 
 tft.setCursor(305, 115);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(gleis[4]);
 //
  tft.fillRect(0,131,360,3,ILI9341_BLACK);
 /// Zeile 6
 tft.setCursor(0, 135);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(uhrzeit[5]);
 
 tft.setCursor(65, 135);
 tft.setTextColor(BLUE, WHITE);
 tft.setTextSize(2);
 tft.print(zugnummer[6]);
 
 tft.setCursor(160, 135);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(ziel[5]);
 
 tft.setCursor(305, 135);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(gleis[4]);
  tft.fillRect(0,151,360,3,ILI9341_BLACK);
 /// Zeile 7
 tft.setCursor(0, 155);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(uhrzeit[5]);
 
 tft.setCursor(65, 155);
 tft.setTextColor(BLUE, WHITE);
 tft.setTextSize(2);
 tft.print(zugnummer[6]);
 
 tft.setCursor(160, 155);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(ziel[5]);
 
 tft.setCursor(305, 155);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(gleis[4]);
 tft.fillRect(0,171,360,3,ILI9341_BLACK);
 /// Zeile 8
 tft.setCursor(0, 175);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(uhrzeit[5]);
 
 tft.setCursor(65, 175);
 tft.setTextColor(BLUE, WHITE);
 tft.setTextSize(2);
 tft.print(zugnummer[6]);
 
 tft.setCursor(160, 175);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(ziel[5]);
 
 tft.setCursor(305, 175);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(gleis[4]);
  tft.fillRect(0,191,360,3,ILI9341_BLACK);
 /// Zeile 9
 tft.setCursor(0, 195);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(uhrzeit[5]);
 
 tft.setCursor(65, 195);
 tft.setTextColor(BLUE, WHITE);
 tft.setTextSize(2);
 tft.print(zugnummer[6]);
 
 tft.setCursor(160, 195);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(ziel[5]);
 
 tft.setCursor(305, 195);
 tft.setTextColor(WHITE, BLUE);
 tft.setTextSize(2);
 tft.print(gleis[4]);
 
 tft.fillRect(0,212,360,5,ILI9341_BLACK);
 

 }
 
 
///////////////////////////////////



////////////////////////////////////
 

  // Uhr
void loop() {
  time_t now = time(nullptr);
  if (localtime(&now)->tm_sec !=old_sec){
    old_sec = localtime(&now)->tm_sec;
    tft.setTextSize(2);
    h=localtime(&now)->tm_hour;
    m=localtime(&now)->tm_min;
    s=localtime(&now)->tm_sec;
    tft.setTextColor(ILI9341_BLUE);
    //tft.setCursor(180,0);
    if(ho != h){
      if (ho<10) tft.print("");
      tft.print(ho);
      }
    tft.setCursor(0,0);
tft.setTextColor(ILI9341_BLACK);
    if(mo != m){
      if (mo<10) tft.print("");
      tft.print(mo);
      }
    tft.setCursor(216,0);
/////////////////////////////




////////////////////scoller
tft.setTextColor(ILI9341_BLUE,WHITE);
//tft.setTextColor(BLACK, WHITE)
tft.setTextSize(3);
String text = "               +++++++++ Das Rauchen in Zügen ist verboten, bitte vor Fahrtantritt am Bahnsteig in den Raucherzonen rauchen +++++++++++++                   "; // sample text Scheiß ÜÜÜÜÜÜ
const int width = 250 ; // width of the marquee display (in characters) volle länge !!! vom Display
// Loop once through the string
for (int offset = 0; offset < text.length(); offset++)
{
// Construct the string to display for this iteration
String t = "";
for (int i = 0; i < width; i++)
t += text.charAt((offset + i) % text.length());
// Print the string for this iteration
tft.setCursor(0, tft.height()/1-22); // display will be halfway down screen
tft.print(t);
// Short delay so the text doesn't move too fast
delay(200);

///////////////////////////////
    ////if (s != so){
    //if (so<10) tft.print("");
    //tft.print(so);
      }
 // Uhrzeit Digital TEXT 
    tft.setTextColor(ILI9341_WHITE, ILI9341_BLACK);
    tft.setTextSize(2);
    tft.setCursor(255,10);
    if (h<10) tft.print("");
    tft.print(h);
    tft.print(":");
    if (m<10) tft.print("");
    tft.print(m);
    //tft.print(":");
    //if (s<10) tft.print("");
    //tft.print(s);
    ho=h;mo=m;so=s;
   
   tft.fillRect( 0, 0, 43, 30, ILI9341_WHITE);
   //ft.drawXBitmap( 2, 2, db_bits, db_width, db_height, ILI9341_RED);
   tft.drawXBitmap( 0, 0, db_bits, 43, 30, ILI9341_RED); }
}
Attachments
displayanzeige.jpg
displayanzeige.jpg (868.64 KiB) Viewed 30 times

sparfux
 
Posts: 2
Joined: Mon Feb 11, 2019 9:25 am

Re: My Scoller is runnig Bad

by sparfux on Mon Feb 11, 2019 9:31 am

Hi all

I have found a big error but my Icons and Time came in 10 sec. later .I think i need a Void Draw line for beeter Loop running .


Code: Select all | TOGGLE FULL SIZE
#include <ESP8266WiFi.h>
#include <time.h>
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#define TFT_DC D3
#define TFT_CS D1
#define rst

//#include <Fonts/FreeMonoBoldOblique12pt7b.h>
//#include <Fonts/FreeSerif9pt7b.h>

#define BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF
// Copyright by chaoskasi
//const char* ssid = "Esu-ModellbahnWlan"; //# WLAN-User anpassen
const char* ssid = "Netzwerkerkennung-fehlgeschlagen"; //# WLAN-User anpassen
const char* pass = "pokerface2000"; //# WLAN-Passwort anpassen
int old_sec;
int h,m,s,ho,mo,so;
Adafruit_ILI9341 tft= Adafruit_ILI9341(TFT_CS, TFT_DC);





int count = 0;
unsigned long previousMillis = 0;     // Speichern letzte zeit der anziege hat sich geändert
const long interval = 31500;          // interval zwischen änderungen (milliseconds)
int varianten = 7;    // / vari
 
// File myFile;
 
 char timeChar[100];
 char dateChar[50];
 
 //Fahrplan definieren Start
 char uhrzeit[][6]{ // [6] ist anzahl ziffern
 
  "00:12",//1
  "00:14",//2
  "04:48",//3
  "05:10",//4
  "05:28",//5
  "05:32",//6
  "06:15",//7
 
 
};
char zugnummer[][7]{// [7] ist anzahl charakteren
 
  "RE 761",//1
  "RB 336",//2
  "RE 841",//3
  "RB5760",//4
  "RE 59 ",//5
  "IC 760",//6
  "ICE223",//7
 
};
 
 
char ziel[][14]{// [11] ist anzahl charakteren
 
  "Warburg Hbf",//1
  "Hamm Hbf",//2
  "Paderborn",//3
  "Hamm Hbf",//4
  "Dortmund",//5
  "Lippstadt",//6
  "Soest Hbf", //7
 
 
 
 
};
 
char gleis[][2]{ //[2] ist anzahl charakteren
 
  "1",//1
  "3",//2
  "1",//3
  "2",//4
  "3",//5
  "1",//6
  "4",//7
 
 
};
 //Fahrplan definieren Ende
 
 

//#define db_width 43
//#define db_height 30
PROGMEM const unsigned char db_bits[] = {
0xfc, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x03,
   0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07,
   0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x47, 0x55, 0x00, 0x55, 0x01, 0x07,
   0xc7, 0xff, 0x81, 0xff, 0x07, 0x07, 0xc7, 0xff, 0x83, 0xff, 0x0f, 0x07,
   0xc7, 0xc7, 0x07, 0x8f, 0x0f, 0x07, 0xc7, 0x83, 0x8f, 0x07, 0x1f, 0x07,
   0xc7, 0x07, 0x8f, 0x0f, 0x1f, 0x07, 0xc7, 0x03, 0x8f, 0x07, 0x0f, 0x07,
   0xc7, 0x03, 0x9e, 0x0f, 0x0f, 0x07, 0xc7, 0x03, 0x9f, 0xff, 0x07, 0x07,
   0xc7, 0x07, 0x8e, 0xff, 0x03, 0x07, 0xc7, 0x03, 0x9f, 0xff, 0x07, 0x07,
   0xc7, 0x03, 0x9e, 0xaf, 0x0f, 0x07, 0xc7, 0x03, 0x8f, 0x0f, 0x1f, 0x07,
   0xc7, 0x07, 0x9f, 0x07, 0x1e, 0x07, 0xc7, 0x03, 0x8f, 0x0f, 0x1e, 0x07,
   0xc7, 0x83, 0x8f, 0x07, 0x1f, 0x07, 0xc7, 0xc7, 0x87, 0x0f, 0x1f, 0x07,
   0xc7, 0xff, 0x87, 0xff, 0x0f, 0x07, 0xc7, 0xff, 0x81, 0xff, 0x07, 0x07,
   0xc7, 0x5f, 0x00, 0x5f, 0x01, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07,
   0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0xdf, 0xfd, 0xb7, 0xfb, 0xee, 0x07,
   0xfe, 0xff, 0xff, 0xff, 0xff, 0x03, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x01 };


// Anmeldung Wlan
void setup() {
  Serial.begin(115200);
  Serial.println("test");
  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
    }
  Serial.println("connected"); // Bestätigung für Wlan
  configTime(2*3600, 0, "0.de.pool.ntp.org"); // Online Zeit
  Serial.println("NTP ok");
 
  // Anfang Display
 
  tft.begin();
  tft.fillScreen(ILI9341_BLUE);
  tft.setRotation(1);

  ///// Scolllert
  void scrolltext(int x, int y, const char *s, uint8_t dw = 1, const GFXfont *f = NULL, int sz = 5)
  ////////////////////////////////////////untergrpg. Scoller
 
 {   
 
  /// Abfahrt Text
  tft.fillRect(0,0,350,32,BLACK);
  tft.setTextColor(BLACK, WHITE); // Abfahr Schrift Farbe / hintergrundfarbe
  // tft.setCursor(100,5); // TEST größe vorne / höhe
  tft.setCursor(50,10);
  tft.setTextSize(2); // Text größe
  tft.print("Abfahrt/Departure");


  ///// vOLL aNZEIGE
  //tft.setTextSize(2);
  //tft.setCursor(35, 0);
  //tft.print("Abfahrt");

  //Zeile 1
  tft.setCursor(0, 35);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(uhrzeit[0]);

  tft.setCursor(65, 35);
  tft.setTextColor(BLUE, WHITE);
  tft.setTextSize(2);
  tft.print(zugnummer[0]);

  tft.setCursor(160, 35);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(ziel[0]);

  tft.setCursor(305, 35);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(gleis[0]);
  ///
  tft.fillRect(0, 51, 320, 3, ILI9341_BLACK);
  //Zeile 2
  tft.setCursor(0, 55);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(uhrzeit[1]);

  tft.setCursor(65, 55);
  tft.setTextColor(BLUE, WHITE);
  tft.setTextSize(2);
  tft.print(zugnummer[1]);

  tft.setCursor(160, 55);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(ziel[1]);

  tft.setCursor(305, 55);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(gleis[1]);

  //
  tft.fillRect(0, 71, 320, 3, ILI9341_BLACK);
  ///
  // Zeile 3
  tft.setCursor(0, 75);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(uhrzeit[2]);

  tft.setCursor(65, 75);
  tft.setTextColor(BLUE, WHITE);
  tft.setTextSize(2);
  tft.print(zugnummer[2]);

  tft.setCursor(160, 75);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(ziel[2]);

  tft.setCursor(305, 75);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(gleis[2]);
  //
  tft.fillRect(0, 91, 320, 3, ILI9341_BLACK);
  ///
  //Zeile 4
  tft.setCursor(0, 95);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(uhrzeit[3]);

  tft.setCursor(65, 95);
  tft.setTextColor(BLUE, WHITE);
  tft.setTextSize(2);
  tft.print(zugnummer[3]);

  tft.setCursor(160, 95);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(ziel[1]);

  tft.setCursor(305, 95);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(gleis[3]);
  //
  tft.fillRect(0, 111, 320, 3, ILI9341_BLACK);
  /// Zeile 5
  tft.setCursor(0, 115);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(uhrzeit[4]);

  tft.setCursor(65, 115);
  tft.setTextColor(BLUE, WHITE);
  tft.setTextSize(2);
  tft.print(zugnummer[6]);

  tft.setCursor(160, 115);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(ziel[4]);

  tft.setCursor(305, 115);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(gleis[4]);
  //
  tft.fillRect(0, 131, 320, 3, ILI9341_BLACK);
  /// Zeile 6
  tft.setCursor(0, 135);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(uhrzeit[5]);

  tft.setCursor(65, 135);
  tft.setTextColor(BLUE, WHITE);
  tft.setTextSize(2);
  tft.print(zugnummer[6]);

  tft.setCursor(160, 135);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(ziel[5]);

  tft.setCursor(305, 135);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(gleis[4]);
  tft.fillRect(0, 151, 320, 3, ILI9341_BLACK);
  /// Zeile 7
  tft.setCursor(0, 155);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(uhrzeit[5]);

  tft.setCursor(65, 155);
  tft.setTextColor(BLUE, WHITE);
  tft.setTextSize(2);
  tft.print(zugnummer[6]);

  tft.setCursor(160, 155);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(ziel[5]);

  tft.setCursor(305, 155);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(gleis[4]);
  tft.fillRect(0, 171, 320, 3, ILI9341_BLACK);
  /// Zeile 8
  tft.setCursor(0, 175);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(uhrzeit[5]);

  tft.setCursor(65, 175);
  tft.setTextColor(BLUE, WHITE);
  tft.setTextSize(2);
  tft.print(zugnummer[6]);

  tft.setCursor(160, 175);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(ziel[5]);

  tft.setCursor(305, 175);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(gleis[4]);
  tft.fillRect(0, 191, 320, 3, ILI9341_BLACK);
  /// Zeile 9
  tft.setCursor(0, 195);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(uhrzeit[5]);

  tft.setCursor(65, 195);
  tft.setTextColor(BLUE, WHITE);
  tft.setTextSize(2);
  tft.print(zugnummer[6]);

  tft.setCursor(160, 195);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(ziel[5]);

  tft.setCursor(305, 195);
  tft.setTextColor(WHITE, BLUE);
  tft.setTextSize(2);
  tft.print(gleis[4]);

  tft.fillRect(0, 211, 320, 4, ILI9341_BLACK);
  tft.fillRect(0, 216, 320, 20, ILI9341_WHITE);

 //// Scoller
    int16_t x1, y1, wid = tft.width(), inview = 1;
    uint16_t w, h;
    tft.setFont(f);
    tft.setTextColor(ILI9341_BLUE,WHITE);
    tft.setTextSize(sz);
    tft.setTextWrap(false);
    tft.getTextBounds((char*)s, x, y, &x1, &y1, &w, &h);
    //    w = strlen(s) * 6 * sz;

    for (int steps = wid + w; steps >= 0; steps -= dw) {
        x = steps - w;
        if (f != NULL) {
            inview = wid - x;
            if (inview > wid) inview = wid;
            if (inview > w) inview = w;
            tft.fillRect(x > 0 ? x : 0, y1, inview + dw, h, BLACK);
        }
        x -= dw;
        tft.setCursor(x, y);
        tft.print(s);
        if (f == NULL) tft.print("  "); //rubout trailing chars
        delay(5);
     }

 
 }/////// ENDE

////////////////////////////////////
 

  // Uhr
void loop() {
  time_t now = time(nullptr);
  if (localtime(&now)->tm_sec !=old_sec){
    old_sec = localtime(&now)->tm_sec;
    tft.setTextSize(2);
    h=localtime(&now)->tm_hour;
    m=localtime(&now)->tm_min;
    s=localtime(&now)->tm_sec;
    tft.setTextColor(ILI9341_BLUE);
    //tft.setCursor(180,0);
    if(ho != h){
      if (ho<10) tft.print("");
      tft.print(ho);
      }
    tft.setCursor(0,0);
tft.setTextColor(ILI9341_BLACK);
    if(mo != m){
      if (mo<10) tft.print("");
      tft.print(mo);
      }
    tft.setCursor(216,0);
///////////////////////////// scoller
  // Uhrzeit Digital TEXT 
    tft.setTextColor(ILI9341_WHITE, ILI9341_BLACK);
    tft.setTextSize(2);
    tft.setCursor(255,10);
    if (h<10) tft.print("");
    tft.print(h);
    tft.print(":");
    if (m<10) tft.print("");
    tft.print(m);
    //tft.print(":");
    //if (s<10) tft.print("");
    //tft.print(s);
    ho=h;mo=m;so=s;
   
   tft.fillRect( 0, 0, 43, 30, ILI9341_WHITE);
   //ft.drawXBitmap( 2, 2, db_bits, db_width, db_height, ILI9341_RED);
   tft.drawXBitmap( 0, 0, db_bits, 43, 30, ILI9341_RED);

 

    scrolltext(0, 220, "  ", 2, NULL, 2);
    scrolltext(0, 220, "      +++++++++ Das Rauchen in Zuegen ist verboten, bitte vor Fahrtantritt am Bahnsteig in den Raucherzonen rauchen ++++++++++++++", 2, NULL,2);
    //scrolltext(0, 220, " --------- NOTFALL 02487/545555 ------------", 2, NULL);
    delay(2000);
   
   }
   }

sparfux
 
Posts: 2
Joined: Mon Feb 11, 2019 9:25 am

Please be positive and constructive with your questions and comments.