Zugzielanzeige für den Bahnhof/Bahnsteig mit Arduino

#1 von kk2111 , 21.07.2022 22:14

hallo zusammen, ich bin neu hier. Und ich habe gleich eine Frage, ich habe das 128x32-Arduino-Display, das Sie für Abfahrtszeiten an Bahnhöfen entworfen haben. Ich habe jetzt eine niederländische Version davon gemacht, mit der Uhr oben und daneben 'Intercity', aber neben Intercity ist das Symbol der niederländischen Eisenbahn oder DB usw., aber ich stecke jetzt fest, weil ich das nicht verstehe Symbol zum Bildschirm hinzugefügt, ich habe eine Skizze mit verschiedenen Logosymbolen für die Arduino-Anzeige erstellt, aber ich kenne den Skizzencode nicht, um das Logosymbol oben rechts zu platzieren. Wer kann mir dabei helfen?

2. Frage, ich hätte gerne eine weiße Hintergrundfarbe und schwarze oder blaue Schrift, bei anderen Sketchen war das kein Problem, aber du hast diese Auswahl im Sketch weggelassen, kann jemand den Sketch-Code der Hintergrundfarbe posten?

Ich werde die Skizze unten posten:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
 
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
 

#define MSG1_PIN 2
#define MSG2_PIN 3
#define MSG3_PIN 4
#define MSG4_PIN 5
#define MSG5_PIN 6
#define MSG6_PIN 7
#define MSG7_PIN 8
#define MSG8_PIN 9
#define TMIN 5 // departure time of next train, minimum of random time
#define TMAX 13 // departure time of next train, maximum of random time
 

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
 

 
byte hour, minute;
byte msgnr,msgnr_old, msgflag, msghour, msgminute;
 

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
 

void calc_msg_time() {
msgminute = minute + random(TMIN, TMAX);
msghour = hour;
if (msgminute > 59) {
msghour = (msghour + 1) % 24;
msgminute = msgminute - 60;
}
}
 

 

 

void setup() {
Serial.begin(115200);
randomSeed (analogRead(0));
hour = random(7, 20);
minute = random(0, 60);
pinMode (MSG1_PIN, INPUT_PULLUP);
pinMode(MSG2_PIN, INPUT_PULLUP);
pinMode (MSG3_PIN, INPUT_PULLUP);
pinMode (MSG4_PIN, INPUT_PULLUP);
pinMode (MSG5_PIN, INPUT_PULLUP);
pinMode (MSG6_PIN, INPUT_PULLUP);
pinMode (MSG7_PIN, INPUT_PULLUP);
pinMode (MSG8_PIN, INPUT_PULLUP);
 

if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
delay(2000);
display.clearDisplay();
 





}
 

 

 

void loop() {
 

// display time and messages
if(!digitalRead(MSG1_PIN)) msgnr = 1;
if(!digitalRead(MSG2_PIN)) msgnr = 2;
if(!digitalRead(MSG3_PIN)) msgnr = 3;
if(!digitalRead(MSG4_PIN)) msgnr = 4;
if(!digitalRead(MSG5_PIN)) msgnr = 5;
if(!digitalRead(MSG6_PIN)) msgnr = 6;
if(!digitalRead(MSG7_PIN)) msgnr = 7;
if(!digitalRead(MSG8_PIN)) msgnr = 8;
 

if(msgnr != msgnr_old) {
calc_msg_time();
msgnr_old = msgnr;
}
 


display.setTextSize(1);
display.setTextColor(WHITE);
switch (msgnr) {
case 1://P5001
display.print(msghour);
display.print(":");
if(msgminute < 10) display.print("0");
display.print(msgminute);
display.setCursor(42, 0); display.println("Intercity");
display.setCursor(0,12);display.setTextSize(1.5); display.println("Maastricht");
display.setCursor(0,22); display.println("Via Utrecht, Arnhem");
display.setCursor(0,0);

display.display();

break;

case 2://P5002
display.print(msghour);
display.print(":");
if(msgminute < 10) display.print("0");
display.print(msgminute);
display.setCursor(42, 0); display.println("Sprinter");
display.setCursor(0,12);display.setTextSize(1.5); display.println("Zwolle");
display.setCursor(0,22); display.println("Via Akkrum, Heerenveen");
display.setCursor(0,0);

display.display();
break;
 


case 3://P5003
display.print(msghour);
display.print(":");
if(msgminute < 10) display.print("0");
display.print(msgminute);
display.setCursor(42, 0); display.println("Sprinter");
display.setCursor(0,12);display.setTextSize(1.5); display.println("Groningen HS");
display.setCursor(0,22); display.println("Via Heerenveen, Assen");
display.setCursor(0,0);

display.display();
break;
 


case 4://p5004
display.print(msghour);
display.print(":");
if(msgminute < 10) display.print("0");
display.print(msgminute);
display.setCursor(0,12);display.setTextSize(1.5); display.println("NIET INSTAPPEN");
display.setCursor(0,0);

display.display();


break;
 

case 5://P5005
display.print(msghour);
display.print(":");
if(msgminute < 10) display.print("0");
display.print(msgminute);
display.setCursor(42, 0); display.println("Sneltrein");
display.setCursor(0,12);display.setTextSize(1.5); display.println("Amsterdam CS");
display.setCursor(0,22); display.println("Via Leystad, Almere");
display.setCursor(0,0);

display.display();
 


break;

case 6://P5006
display.print(msghour);
display.print(":");
if(msgminute < 10) display.print("0");
display.print(msgminute);
display.setCursor(42, 0); display.println("IC Brussel");
display.setCursor(0,12);display.setTextSize(1.5); display.println("Brussel");
display.setCursor(0,22); display.println("Via Rotterdam, Breda");
display.setCursor(0,0);

display.display();
break;
 

case 7://classic
display.print(msghour);
display.print(":");
if(msgminute < 10) display.print("0");
display.print(msgminute);
display.setCursor(42, 0); display.println("IC Direct");
display.setCursor(0,12);display.setTextSize(1.5); display.println("Den Haag");
display.setCursor(0,22); display.println("Via Lelystad,Schiphol");
display.setCursor(0,0);

display.display();
 


break;
 

case 8://P5008
display.print(msghour);
display.print(":");
if(msgminute < 10) display.print("0");
display.print(msgminute);
display.setCursor(42, 0); display.println("Intercity");
display.setCursor(0,12);display.setTextSize(1.5); display.println("Vlissingen");
display.setCursor(0,22); display.println("Via Lelystad, Breda");
display.setCursor(0,0);

display.display();
break;

}
 

display.clearDisplay();




}
 


kk2111  
kk2111
Beiträge: 6
Registriert am: 21.07.2022


RE: Zugzielanzeige für den Bahnhof/Bahnsteig mit Arduino

#2 von Hobbyprog , 28.07.2022 09:55

Hallo
kann es sein, das die <Adafruit_SSD1306.h> nur für monochrome Displays ist.
Dann kannst Du nur das Display invertieren.

Einfach mal im Netz suchen;
Eigenes Symbol für das OLED Display
https://tutorials-raspberrypi.de/esp8266...-text-anzeigen/

Viele Grüße Martin


 
Hobbyprog
InterRegioExpress (IRE)
Beiträge: 427
Registriert am: 03.11.2020
Homepage: Link
Ort: NRW
Spurweite H0
Steuerung DCC Eigenbau
Stromart Digital

zuletzt bearbeitet 28.07.2022 | Top

RE: Zugzielanzeige für den Bahnhof/Bahnsteig mit Arduino

#3 von GerdR , 28.07.2022 11:04

@kk2111

Die Displays (SSD1306) gibt es in verschiedenen Varianten:
----------------------------------------------
128 * 64 Pixel; Diagonale 0,96 Zoll; Farben weiß, blau, gelb oder zweifarbig gelb-blau
128 * 32 Pixel; 0,91 Zoll; weiß, blau oder gelb
64 * 48 Pixel; 0,66 Zoll; weiß
72 * 40 Pixel; 0,42 Zoll; weiß
----------------------------------------------
At the beginning of your Arduino code be sure that you declared the object using the same name.

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

To invert the display:

display.invertDisplay(true);

To return the display again

display.invertDisplay(false);

----------------------------------------------

ADAFruit Library und Beispiele

Bitmap Converter

Was dann noch fehlt ist die Grafik für den BitmapConverter

GerdR


GerdR  
GerdR
InterRegio (IR)
Beiträge: 164
Registriert am: 27.02.2020
Spurweite H0e
Steuerung Z21PG, DCC++, Eigenbaudecoder
Stromart Digital


RE: Zugzielanzeige für den Bahnhof/Bahnsteig mit Arduino

#4 von kk2111 , 28.07.2022 23:05

Hallo zusammen, hiermit die Skizze von NS Bild, bekomme jetzt noch das Wort Intercity für das Display, ich verwende 128x32 Display

Skizzieren:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Fonts/FreeMonoBoldOblique24pt7b.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#define bitmap_height 128
#define bitmap_width 32
const unsigned char myBitmap [512] PROGMEM = {
// 'nslogo33, 128x32px
0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x7f, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x7f, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0x00, 0x00, 0x3f, 0xe0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0x80, 0x00, 0x1f, 0xf0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x0f, 0xf8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x07, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7f, 0xc0, 0x00, 0x1f, 0xf0, 0x00, 0x03, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xff, 0x80, 0x00, 0x0f, 0xf8, 0x00, 0x01, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0xff, 0x00, 0x00, 0x07, 0xfc, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0xfe, 0x00, 0x00, 0x03, 0xfe, 0x00, 0x00, 0x7f, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0xfc, 0x00, 0x00, 0x01, 0xff, 0x00, 0x00, 0x3f, 0xe0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0f, 0xf8, 0x00, 0x00, 0x00, 0xff, 0x80, 0x00, 0x1f, 0xf0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1f, 0xf0, 0x00, 0x00, 0x00, 0x7f, 0xc0, 0x00, 0x0f, 0xf8, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xc0, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x0f, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x07, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xf8, 0x03, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xfc, 0x00, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1f, 0xf0, 0x00, 0x03, 0xfe, 0x00, 0x00, 0x00, 0x0f, 0xf8, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0f, 0xf8, 0x00, 0x01, 0xff, 0x00, 0x00, 0x00, 0x1f, 0xf0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0xfc, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0x3f, 0xe0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0xfe, 0x00, 0x00, 0x7f, 0xc0, 0x00, 0x00, 0x7f, 0xc0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0xff, 0x00, 0x00, 0x3f, 0xe0, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xff, 0x80, 0x00, 0x1f, 0xf0, 0x00, 0x01, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x7f, 0xc0, 0x00, 0x0f, 0xf8, 0x00, 0x03, 0xfe, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3f, 0xe0, 0x00, 0x07, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1f, 0xf0, 0x00, 0x03, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0f, 0xf8, 0x00, 0x01, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x07, 0xfc, 0x00, 0x00, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0x00, 0x00, 0x0f, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00
};
void setup() {
Serial.begin(9600);
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x32
Serial.println(F("SSD1306 allocation failed"));
for (;;); // Don't proceed, loop forever
}
// Clear the buffer
display.clearDisplay();
}
void loop() {
showBitmap();
}
void showBitmap(void) {
display.clearDisplay();
display.drawBitmap(0, 0, myBitmap, bitmap_height, bitmap_width, WHITE);
display.display();
delay(1000);
}
 
 


kk2111  
kk2111
Beiträge: 6
Registriert am: 21.07.2022


   

Problem bei Programmierung von Lok Sound 5
(Märklin) Decoder Innenleben - Schaltungsanalyse auf Die-Ebene

  • Ähnliche Themen
    Antworten
    Zugriffe
    Letzter Beitrag
Xobor Einfach ein eigenes Forum erstellen
Datenschutz