EmbDev.net

Forum: µC & Digital Electronics RGB Matrix Library


von Fabian Müller (Guest)


Rate this post
useful
not useful
Hi all

I wanted to create a word clock with a RGB LED Matrix. I bought the 
32x32 LED RGB Matrix off Adafruit (Product ID: 1484) and it looks 
awesome.
I 3D printed a front plate with the letters cut out.
my next idea was to combine it with a DCF77 module. but that wasnt 
reliable enough to use in the final version.
So i settled for a RTC. (Chip DS3231) which communicates with Arduino 
over I2C.
It doesnt seem to be working. I assume that the two librarys dont work 
together because they define a same thing in 2 different ways.
This is the whole code (im very sorry, some words are in swiss german, 
those are only variables to describe the time tho and could be chosen 
freely):
1
//-------Librarys Realtime Clock---------
2
//#include <Wire.h>
3
//#include "DS3231.h"
4
5
//-------Librarys LED Matrix-------------
6
#include <gamma.h>
7
#include <RGBmatrixPanel.h>
8
9
#include <Adafruit_GFX.h>
10
#include <Adafruit_SPITFT.h>
11
#include <Adafruit_SPITFT_Macros.h>
12
#include <gfxfont.h>
13
14
15
//------Defines for LED Matrix----------
16
#define CLK  8
17
#define OE   9
18
#define LAT 10
19
#define A   A0
20
#define B   A1
21
#define C   A2
22
#define D   A3
23
24
//--------Colour Variables-------------
25
int red, green, blue;
26
27
//--------All Pins for LED Matrix------
28
RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false);
29
30
//---------Realtime Clock--------------
31
RTClib RTC;
32
33
void setup()
34
{
35
  matrix.begin();
36
  Wire.begin();
37
 
38
  red = 0;
39
  green = 7;
40
  blue = 0;
41
}
42
43
void loop()
44
{
45
  delay(100);
46
47
  DateTime now = RTC.now();
48
  
49
  //clear Matrix
50
  matrix.fillScreen(0);
51
  
52
  //write the time to the Matrix
53
  es();
54
  isch();
55
56
  switch(int stund = now.hour())
57
  {
58
    case 1:
59
    {
60
      eis();
61
      break;
62
    }
63
    case 2:
64
    {
65
      zwei();
66
      break;
67
    }
68
    case 3:
69
    {
70
      drue();
71
      break;
72
    }
73
    case 4:
74
    {
75
      vieri();
76
      break;
77
    }
78
    case 5:
79
    {
80
      fuefi();
81
      break;
82
    }
83
    case 6:
84
    {
85
      saechsi();
86
      break;
87
    }
88
    case 7:
89
    {
90
      sibni();
91
      break;
92
    }
93
    case 8:
94
    {
95
      achti();
96
      break;
97
    }
98
    case 9:
99
    {
100
      nueni();
101
      break;
102
    }
103
    case 10:
104
    {
105
      zaeni();
106
      break;
107
    }
108
    case 11:
109
    {
110
      elfi();
111
      break;
112
    }
113
    case 12:
114
    {
115
      zwoelfi();
116
      break;
117
    }
118
  }
119
  
120
  switch(int minuute = now.minute())
121
  {
122
    case 1:
123
    {
124
      //progressBalk
125
      break;
126
    }
127
    case 2:
128
    {
129
      //progressBalk
130
      break;
131
    }
132
    case 3:
133
    {
134
      //progressBalk
135
      break;
136
    }
137
    case 4:
138
    {
139
      //progressBalk
140
      break;
141
    }
142
    case 5:
143
    {
144
      fuef();
145
      ab();
146
      //progressBalk
147
      break;
148
    }
149
    case 6:
150
    {
151
      fuef();
152
      ab();
153
      //progressBalk
154
      break;
155
    }
156
    case 7:
157
    {
158
      fuef();
159
      ab();
160
      //progressBalk
161
      break;
162
    }
163
    
164
//i think you get the point here... ;)
165
    
166
    case 55:
167
    {
168
      fuef();
169
      vor();
170
      //progressBalk
171
      break;
172
    }
173
    case 56:
174
    {
175
      fuef();
176
      vor();
177
      //progressBalk
178
      break;
179
    }
180
    case 57:
181
    {
182
      fuef();
183
      vor();
184
      //progressBalk
185
      break;
186
    }
187
    case 58:
188
    {
189
      fuef();
190
      vor();
191
      //progressBalk
192
      break;
193
    }
194
    case 59:
195
    {
196
      fuef();
197
      vor();
198
      //progressBalk
199
      break;
200
    }
201
    case 0:
202
    {
203
      //progressBalk
204
      break;
205
    }
206
  }
207
}
208
209
void es(void)
210
{
211
  matrix.fillRect(5, 1, 4, 3, matrix.Color333(red, green, blue));
212
}
213
214
void isch(void)
215
{
216
  matrix.fillRect(11, 1, 8, 3, matrix.Color333(red, green, blue));
217
}
218
219
void fuef(void)
220
{
221
  matrix.fillRect(21, 1, 6, 3, matrix.Color333(red, green, blue));
222
}
223
224
void viertl(void)
225
{
226
  matrix.fillRect(5, 4, 12, 3, matrix.Color333(red, green, blue));
227
}
228
229
void zaeae(void)
230
{
231
  matrix.fillRect(21, 4, 6, 3, matrix.Color333(red, green, blue));
232
}
233
234
void zwaenzg(void)
235
{
236
  matrix.fillRect(5, 7, 12, 3, matrix.Color333(red, green, blue));
237
}
238
239
void vor(void)
240
{
241
  matrix.fillRect(21, 7, 6, 3, matrix.Color333(red, green, blue));
242
}
243
244
void ab(void)
245
{
246
  matrix.fillRect(5, 10, 4, 3, matrix.Color333(red, green, blue));
247
}
248
249
void halbi(void)
250
{
251
  matrix.fillRect(11, 10, 10, 3, matrix.Color333(red, green, blue));
252
}
253
254
void eis(void)
255
{
256
  matrix.fillRect(5, 13, 6, 3, matrix.Color333(red, green, blue));
257
}
258
259
void zwei(void)
260
{
261
  matrix.fillRect(11, 13, 8, 3, matrix.Color333(red, green, blue));
262
}
263
264
void drue(void)
265
{
266
  matrix.fillRect(21, 13, 6, 3, matrix.Color333(red, green, blue));
267
}
268
269
void vieri(void)
270
{
271
  matrix.fillRect(5, 16, 10, 3, matrix.Color333(red, green, blue));
272
}
273
274
void fuefi(void)
275
{
276
  matrix.fillRect(15, 16, 8, 3, matrix.Color333(red, green, blue));
277
}
278
279
void saechsi(void)
280
{
281
  matrix.fillRect(5, 19, 12, 3, matrix.Color333(red, green, blue));
282
}
283
284
void sibni(void)
285
{
286
  matrix.fillRect(18, 19, 10, 3, matrix.Color333(red, green, blue));
287
}
288
289
void achti(void)
290
{
291
  matrix.fillRect(5, 22, 10, 3, matrix.Color333(red, green, blue));
292
}
293
294
void nueni(void)
295
{
296
  matrix.fillRect(15, 22, 8, 3, matrix.Color333(red, green, blue));
297
}
298
299
void zaeni(void)
300
{
301
  matrix.fillRect(5, 25, 8, 3, matrix.Color333(red, green, blue));
302
}
303
304
void elfi(void)
305
{
306
  matrix.fillRect(18, 25, 8, 3, matrix.Color333(red, green, blue));
307
}
308
309
void zwoelfi(void)
310
{
311
  matrix.fillRect(5, 28, 12, 3, matrix.Color333(red, green, blue));
312
}


It would be awesome if i could get a tipp about whats the problem.
Im quite stuck at the moment.

Every help is deeply apprechiated!
Greetings from switzerland and thanks in advance!

Cheers Fabian :):)

Here is the discussion on the Arduino Forum.
https://forum.arduino.cc/index.php?topic=604825.msg4105484#msg4105484

: Moved by User
von Fabian Müller (Guest)


Rate this post
useful
not useful
Sorry ich habe gerade gemerkt dass ich den Code als Datei angehängt 
haben sollte.
Tut mir leid, kann ich dies noch anpassen?

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.