forked from tehniq3/MaxMatrix-control
-
Notifications
You must be signed in to change notification settings - Fork 0
/
maxmatrix_ds18b20_dht_4module_ver7m2.ino
558 lines (490 loc) · 19.2 KB
/
maxmatrix_ds18b20_dht_4module_ver7m2.ino
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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
// Maxmatrix library:
// https://brainy-bits.com/tutorials/scroll-text-using-the-max7219-led-dot-matrix/
// https://code.google.com/p/arudino-maxmatrix-library/
// niq_ro from
// http://arduinotehniq.blogspot.com
// http://nicuflorica.blogspot.ro/
// original sketch - ver.7.2, Craiova, Romania, 03.11.2015
// clear i2c bus: http://www.forward.com.au/pfod/ArduinoProgramming/I2C_ClearBus/index.html
/**
* I2C_ClearBus
* ( http://www.forward.com.au/pfod/ArduinoProgramming/I2C_ClearBus/index.html )
* (c)2014 Forward Computing and Control Pty. Ltd.
* NSW Australia, www.forward.com.au
* This code may be freely used for both private and commerical use
*/
// for DS18B20 - http://arduinoprojects.ru/2014/08/%D0%BF%D1%80%D0%BE%D1%81%D1%82%D0%BE%D0%B9-%D1%82%D0%B5%D1%80%D0%BC%D0%BE%D1%81%D1%82%D0%B0%D1%82-%D0%BD%D0%B0-arduino-%D0%B8-%D1%86%D0%B8%D1%84%D1%80%D0%BE%D0%B2%D0%BE%D0%BC-%D1%82%D0%B5%D1%80%D0%BC/
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 8
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
#include <MaxMatrix.h>
#include <avr/pgmspace.h>
PROGMEM prog_uchar CH[] = {
3, 8, B00000000, B00000000, B00000000, B00000000, B00000000, // space
1, 8, B01011111, B00000000, B00000000, B00000000, B00000000, // !
3, 8, B00000011, B00000000, B00000011, B00000000, B00000000, // "
5, 8, B00010100, B00111110, B00010100, B00111110, B00010100, // #
4, 8, B00100100, B01101010, B00101011, B00010010, B00000000, // $
5, 8, B01100011, B00010011, B00001000, B01100100, B01100011, // %
5, 8, B00110110, B01001001, B01010110, B00100000, B01010000, // &
1, 8, B00000011, B00000000, B00000000, B00000000, B00000000, // '
3, 8, B00011100, B00100010, B01000001, B00000000, B00000000, // (
3, 8, B01000001, B00100010, B00011100, B00000000, B00000000, // )
5, 8, B00101000, B00011000, B00001110, B00011000, B00101000, // *
5, 8, B00001000, B00001000, B00111110, B00001000, B00001000, // +
2, 8, B10110000, B01110000, B00000000, B00000000, B00000000, // ,
4, 8, B00001000, B00001000, B00001000, B00001000, B00000000, // -
2, 8, B01100000, B01100000, B00000000, B00000000, B00000000, // .
4, 8, B01100000, B00011000, B00000110, B00000001, B00000000, // /
4, 8, B00111110, B01000001, B01000001, B00111110, B00000000, // 0
//3, 8, B01000010, B01111111, B01000000, B00000000, B00000000, // 1
4, 8, B01000100, B01000010, B01111111, B01000000, B00000000, // 1
4, 8, B01100010, B01010001, B01001001, B01000110, B00000000, // 2
4, 8, B00100010, B01000001, B01001001, B00110110, B00000000, // 3
4, 8, B00011000, B00010100, B00010010, B01111111, B00000000, // 4
4, 8, B00100111, B01000101, B01000101, B00111001, B00000000, // 5
4, 8, B00111110, B01001001, B01001001, B00110000, B00000000, // 6
4, 8, B01100001, B00010001, B00001001, B00000111, B00000000, // 7
4, 8, B00110110, B01001001, B01001001, B00110110, B00000000, // 8
4, 8, B00000110, B01001001, B01001001, B00111110, B00000000, // 9
//2, 8, B01010000, B00000000, B00000000, B00000000, B00000000, // :
//3, 8, B00010100, B00000000, B00000000, B00000000, B00000000, // :
3, 8, B00110110, B00110110, B00000000, B00000000, B00000000, // :
2, 8, B10000000, B01010000, B00000000, B00000000, B00000000, // ;
3, 8, B00010000, B00101000, B01000100, B00000000, B00000000, // <
3, 8, B00010100, B00010100, B00010100, B00000000, B00000000, // =
3, 8, B01000100, B00101000, B00010000, B00000000, B00000000, // >
4, 8, B00000010, B01011001, B00001001, B00000110, B00000000, // ?
5, 8, B00111110, B01001001, B01010101, B01011101, B00001110, // @
4, 8, B01111110, B00010001, B00010001, B01111110, B00000000, // A
4, 8, B01111111, B01001001, B01001001, B00110110, B00000000, // B
4, 8, B00111110, B01000001, B01000001, B00100010, B00000000, // C
4, 8, B01111111, B01000001, B01000001, B00111110, B00000000, // D
4, 8, B01111111, B01001001, B01001001, B01000001, B00000000, // E
4, 8, B01111111, B00001001, B00001001, B00000001, B00000000, // F
4, 8, B00111110, B01000001, B01001001, B01111010, B00000000, // G
4, 8, B01111111, B00001000, B00001000, B01111111, B00000000, // H
3, 8, B01000001, B01111111, B01000001, B00000000, B00000000, // I
4, 8, B00110000, B01000000, B01000001, B00111111, B00000000, // J
4, 8, B01111111, B00001000, B00010100, B01100011, B00000000, // K
4, 8, B01111111, B01000000, B01000000, B01000000, B00000000, // L
5, 8, B01111111, B00000010, B00001100, B00000010, B01111111, // M
5, 8, B01111111, B00000100, B00001000, B00010000, B01111111, // N
4, 8, B00111110, B01000001, B01000001, B00111110, B00000000, // O
4, 8, B01111111, B00001001, B00001001, B00000110, B00000000, // P
4, 8, B00111110, B01000001, B01000001, B10111110, B00000000, // Q
4, 8, B01111111, B00001001, B00001001, B01110110, B00000000, // R
4, 8, B01000110, B01001001, B01001001, B00110010, B00000000, // S
5, 8, B00000001, B00000001, B01111111, B00000001, B00000001, // T
4, 8, B00111111, B01000000, B01000000, B00111111, B00000000, // U
5, 8, B00001111, B00110000, B01000000, B00110000, B00001111, // V
5, 8, B00111111, B01000000, B00111000, B01000000, B00111111, // W
5, 8, B01100011, B00010100, B00001000, B00010100, B01100011, // X
5, 8, B00000111, B00001000, B01110000, B00001000, B00000111, // Y
4, 8, B01100001, B01010001, B01001001, B01000111, B00000000, // Z
2, 8, B01111111, B01000001, B00000000, B00000000, B00000000, // [
4, 8, B00000001, B00000110, B00011000, B01100000, B00000000, // \ backslash
2, 8, B01000001, B01111111, B00000000, B00000000, B00000000, // ]
3, 8, B00000010, B00000001, B00000010, B00000000, B00000000, // hat
4, 8, B01000000, B01000000, B01000000, B01000000, B00000000, // _
2, 8, B00000001, B00000010, B00000000, B00000000, B00000000, // `
4, 8, B00100000, B01010100, B01010100, B01111000, B00000000, // a
4, 8, B01111111, B01000100, B01000100, B00111000, B00000000, // b
4, 8, B00111000, B01000100, B01000100, B00101000, B00000000, // c
4, 8, B00111000, B01000100, B01000100, B01111111, B00000000, // d
4, 8, B00111000, B01010100, B01010100, B00011000, B00000000, // e
3, 8, B00000100, B01111110, B00000101, B00000000, B00000000, // f
4, 8, B10011000, B10100100, B10100100, B01111000, B00000000, // g
4, 8, B01111111, B00000100, B00000100, B01111000, B00000000, // h
3, 8, B01000100, B01111101, B01000000, B00000000, B00000000, // i
4, 8, B01000000, B10000000, B10000100, B01111101, B00000000, // j
4, 8, B01111111, B00010000, B00101000, B01000100, B00000000, // k
3, 8, B01000001, B01111111, B01000000, B00000000, B00000000, // l
5, 8, B01111100, B00000100, B01111100, B00000100, B01111000, // m
4, 8, B01111100, B00000100, B00000100, B01111000, B00000000, // n
4, 8, B00111000, B01000100, B01000100, B00111000, B00000000, // o
4, 8, B11111100, B00100100, B00100100, B00011000, B00000000, // p
4, 8, B00011000, B00100100, B00100100, B11111100, B00000000, // q
4, 8, B01111100, B00001000, B00000100, B00000100, B00000000, // r
4, 8, B01001000, B01010100, B01010100, B00100100, B00000000, // s
3, 8, B00000100, B00111111, B01000100, B00000000, B00000000, // t
4, 8, B00111100, B01000000, B01000000, B01111100, B00000000, // u
5, 8, B00011100, B00100000, B01000000, B00100000, B00011100, // v
5, 8, B00111100, B01000000, B00111100, B01000000, B00111100, // w
5, 8, B01000100, B00101000, B00010000, B00101000, B01000100, // x
4, 8, B10011100, B10100000, B10100000, B01111100, B00000000, // y
3, 8, B01100100, B01010100, B01001100, B00000000, B00000000, // z
3, 8, B00001000, B00110110, B01000001, B00000000, B00000000, // {
1, 8, B01111111, B00000000, B00000000, B00000000, B00000000, // |
3, 8, B01000001, B00110110, B00001000, B00000000, B00000000, // }
//4, 8, B00001000, B00000100, B00001000, B00000100, B00000000, // ~
3, 8, B00000110, B00001001, B00000110, B00000000, B00000000, // ~
};
int data = 12; // DIN pin of MAX7219 module
int load = 10; // CS pin of MAX7219 module
int clock = 11; // CLK pin of MAX7219 module
int maxInUse = 4; //how many MAX7219 are connected
MaxMatrix m(data, load, clock, maxInUse); // define Library
byte buffer[10];
// char string1[] = " niq_ro test sketch from https://brainy-bits.com/tutorials/scroll-text-using-the-max7219-led-dot-matrix/ "; // Scrolling Text
/*
// english language
char string4[] = " temperature: "; // Fixxed text
char string5[] = " relative humidity: "; // Fixxed text
char string6[] = " clock: "; // Fixxed text
char string7[] = " date: "; // Fixxed text
*/
/*
// roumanian language (in romana)
char string4[] = " temperatura: "; // Fixxed text
char string5[] = " umiditate relativa: "; // Fixxed text
char string6[] = " ceas: "; // Fixxed text
char string7[] = " data: "; // Fixxed text
*/
// no subtitles (fara comentarii)
char string4[] = " "; // Fixxed text
char string5[] = " "; // Fixxed text
char string6[] = " "; // Fixxed text
// char string7[] = " data: "; // Fixxed text
// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain
#include "DHT.h"
#define DHTPIN A2 // what pin we're connected to A2
// Uncomment whatever type you're using!
#define DHTTYPE DHT11 // DHT 11
//#define DHTTYPE DHT22 // DHT 22 (AM2302)
//#define DHTTYPE DHT21 // DHT 21 (AM2301)
// if is just sensor:
// Connect pin 1 (on the left) of the sensor to +5V
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor
DHT dht(DHTPIN, DHTTYPE);
#include <Wire.h>
#include "RTClib.h" // from https://github.com/adafruit/RTClib
//#include <Encoder.h> // from http://www.pjrc.com/teensy/td_libs_Encoder.html
RTC_DS1307 RTC; // Tells the RTC library that we're using a DS1307 RTC
byte spid = 25;
int photocellPin = A1; // the cell and 10K pulldown are connected to a0
int photocellReading; // the analog reading from the analog resistor divider
/**
* This routine turns off the I2C bus and clears it
* on return SCA and SCL pins are tri-state inputs.
* You need to call Wire.begin() after this to re-enable I2C
* This routine does NOT use the Wire library at all.
*
* returns 0 if bus cleared
* 1 if SCL held low.
* 2 if SDA held low by slave clock stretch for > 2sec
* 3 if SDA held low after 20 clocks.
*/
int I2C_ClearBus() {
TWCR &= ~(_BV(TWEN)); //Disable the Atmel 2-Wire interface so we can control the SDA and SCL pins directly
pinMode(SDA, INPUT_PULLUP); // Make SDA (data) and SCL (clock) pins Inputs with pullup.
pinMode(SCL, INPUT_PULLUP);
delay(2500); // Wait 2.5 secs. This is strictly only necessary on the first power
// up of the DS3231 module to allow it to initialize properly,
// but is also assists in reliable programming of FioV3 boards as it gives the
// IDE a chance to start uploaded the program
// before existing sketch confuses the IDE by sending Serial data.
boolean SCL_LOW = (digitalRead(SCL) == LOW); // Check is SCL is Low.
if (SCL_LOW) { //If it is held low Arduno cannot become the I2C master.
return 1; //I2C bus error. Could not clear SCL clock line held low
}
boolean SDA_LOW = (digitalRead(SDA) == LOW); // vi. Check SDA input.
int clockCount = 20; // > 2x9 clock
while (SDA_LOW && (clockCount > 0)) { // vii. If SDA is Low,
clockCount--;
// Note: I2C bus is open collector so do NOT drive SCL or SDA high.
pinMode(SCL, INPUT); // release SCL pullup so that when made output it will be LOW
pinMode(SCL, OUTPUT); // then clock SCL Low
delayMicroseconds(10); // for >5uS
pinMode(SCL, INPUT); // release SCL LOW
pinMode(SCL, INPUT_PULLUP); // turn on pullup resistors again
// do not force high as slave may be holding it low for clock stretching.
delayMicroseconds(10); // for >5uS
// The >5uS is so that even the slowest I2C devices are handled.
SCL_LOW = (digitalRead(SCL) == LOW); // Check if SCL is Low.
int counter = 20;
while (SCL_LOW && (counter > 0)) { // loop waiting for SCL to become High only wait 2sec.
counter--;
delay(100);
SCL_LOW = (digitalRead(SCL) == LOW);
}
if (SCL_LOW) { // still low after 2 sec error
return 2; // I2C bus error. Could not clear. SCL clock line held low by slave clock stretch for >2sec
}
SDA_LOW = (digitalRead(SDA) == LOW); // and check SDA input again and loop
}
if (SDA_LOW) { // still low
return 3; // I2C bus error. Could not clear. SDA data line held low
}
// else pull SDA line low for Start or Repeated Start
pinMode(SDA, INPUT); // remove pullup.
pinMode(SDA, OUTPUT); // and then make it LOW i.e. send an I2C Start or Repeated start control.
// When there is only one I2C master a Start or Repeat Start has the same function as a Stop and clears the bus.
/// A Repeat Start is a Start occurring after a Start with no intervening Stop.
delayMicroseconds(10); // wait >5uS
pinMode(SDA, INPUT); // remove output low
pinMode(SDA, INPUT_PULLUP); // and make SDA high i.e. send I2C STOP control.
delayMicroseconds(10); // x. wait >5uS
pinMode(SDA, INPUT); // and reset pins as tri-state inputs which is the default state on reset
pinMode(SCL, INPUT);
return 0; // all ok
}
// end part for clear i2c bus
void setup(){
m.init(); // module MAX7219
m.setIntensity(1); // LED Intensity 0-15
byte c;
delay(100);
m.shiftLeft(false, true);
// Initialize DHT sensor
dht.begin();
// put your setup code here, to run once:
Serial.begin(9600);
int rtn = I2C_ClearBus(); // clear the I2C bus first before calling Wire.begin()
if (rtn != 0) {
Serial.println(F("I2C bus error. Could not clear"));
if (rtn == 1) {
Serial.println(F("SCL clock line held low"));
} else if (rtn == 2) {
Serial.println(F("SCL clock line held low by slave clock stretch"));
} else if (rtn == 3) {
Serial.println(F("SDA data line held low"));
}
} else { // bus clear
// re-enable Wire
// now can start Wire Arduino master
Wire.begin();
}
Serial.println("setup finished");
// Wire.begin();
RTC.begin();
if (! RTC.isrunning()) {
//Serial.println("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
RTC.adjust(DateTime(__DATE__, __TIME__));
}
// Serial.begin(9600);
// for DS18B20 sensor
sensors.begin();
// 11 bit resolution by default (9 - low, 10, 11 or 12 - best)
// Note the programmer is responsible for the right delay
// we could do something usefull here instead of the delay
int resolution = 11;
sensors.setResolution(resolution);
delay(750/ (1 << (12-resolution)));
}
void loop(){
lumina();
// Reading temperature or humidity
int has = dht.readHumidity();
/*
float te = dht.readTemperature();
// int te = dht.readTemperature();
*/
// using DS18B20 ( http://arduinoprojects.ru/2014/08/%D0%BF%D1%80%D0%BE%D1%81%D1%82%D0%BE%D0%B9-%D1%82%D0%B5%D1%80%D0%BC%D0%BE%D1%81%D1%82%D0%B0%D1%82-%D0%BD%D0%B0-arduino-%D0%B8-%D1%86%D0%B8%D1%84%D1%80%D0%BE%D0%B2%D0%BE%D0%BC-%D1%82%D0%B5%D1%80%D0%BC/ )
sensors.requestTemperatures(); // запрос на получение температуры
float te=(sensors.getTempCByIndex(0));
delay(250);
int t2 = 10*te;
// value for test display:
// t2 = 297;
//t2 = 14;
// t2 = 0;
// t2 = -15;
// t2 = -123;
/*
// clear the screen
printString1(" ", 0);
*/
lumina();
printStringWithShift(string4, spid); // Send scrolling Text
//printString(string4);
// delay(2000);
lumina();
if (t2 >= 0)
{
if (t2 >=100) printString1("+", 0);
else printString1("+", 4);
}
else
{
if (t2 <=-100) printString1("-", 0);
else printString1("-", 4);
}
if (t2 < 0) t2 = -t2;
// http://www.arduino-hacks.com/converting-integer-to-character-vice-versa/
char c[3], d[2];
String str1, str2;
int t2z = t2/10;
int t2u = t2 - t2z*10;
str1=String(t2z);
str1.toCharArray(c,3);
str2=String(t2u);
str2.toCharArray(d,2);
if (t2 >= 100)
{
printString1(c, 5);
}
else
{
printString1(c, 9);
}
// delay(1000);
printString1(",", 15);
printString1(d, 19);
printString1("~C", 24);
lumina();
delay(5000);
lumina();
lumina();
DateTime now = RTC.now();
int ora = now.hour();
int minut = now.minute();
int anul=now.year();
int luna=now.month();
int ziua=now.day();
lumina();
// https://www.arduino.cc/en/Reference/StringToCharArray
String data;
//data = " date: ";
//data = " data: ";
data = " "; // no subtitle
if (ziua >= 10) data = data + ziua;
else data = data + "0" + ziua;
data = data + ".";
//String data = ziua + ".";
if (luna >= 10) data = data + luna;
else
{
data = data + "0";
data = data + luna;
}
data = data + ".";
data = data + anul;
//String data[20] = ziua + "." + luna + "." + anul;
char data1[20];
//data1=String(data);
data.toCharArray(data1,30);
lumina();
// printStringWithShift(string7, spid); // Send scrolling Text
printStringWithShift(data1, spid); // Send scrolling Text
lumina();
//int second0 = now.second();
//delay(500);
printStringWithShift(string6, spid); // Send scrolling Text
lumina();
// clear the screen
//printString1(" ", 0);
// http://www.arduino-hacks.com/converting-integer-to-character-vice-versa/
char e[3], f[3];
String str3, str4;
str3=String(ora);
str3.toCharArray(e,3);
str4=String(minut);
str4.toCharArray(f,3);
lumina();
if (ora >= 10) printString1(e, 5);
else
{
printString1(" ", 5);
printString1(e, 9);
}
if (minut >= 10) printString1(f, 19);
else
{
printString1("0", 19);
printString1(f, 24);
}
for(int j=0; j<7; j++) // time in seconds (j<7) for display hour
{
//printString1(e, 5);
printString1(":", 15);
//printString1(f, 19);
delay(700);
printString1(" ", 15);
delay(300);
}
printStringWithShift(string5, spid); // Send scrolling Text
//printString(string4);
// delay(2000);
lumina();
// http://www.arduino-hacks.com/converting-integer-to-character-vice-versa/
char b[3];
String str;
str=String(has);
str.toCharArray(b,3);
// printString(b);
printString1(b, 3);
// delay(1000);
printString1("%rh", 13);
delay(3000); // time for display hunmidity (in ms)
//delay(3000);
} // end main loop
// Put extracted character on Display
void printCharWithShift(char c, int shift_speed){
if (c < 32) return;
c -= 32;
memcpy_P(buffer, CH + 7*c, 7);
m.writeSprite(maxInUse*8, 0, buffer);
m.setColumn(maxInUse*8 + buffer[0], 0);
for (int i=0; i<buffer[0]+1; i++)
// for (int i=0; i<buffer[0]+1; i++)
{
delay(shift_speed);
m.shiftLeft(false, false);
}
}
// Extract characters from Scrolling text
void printStringWithShift(char* s, int shift_speed){
/* printCharWithShift(48, shift_speed);
delay(5000);
printCharWithShift(49, shift_speed);
delay(5000);
*/
while (*s != 0){
printCharWithShift(*s, shift_speed);
s++;
}
}
void printString(char* s)
{
int col = 0;
while (*s != 0)
{
if (*s < 32) continue;
char c = *s - 32;
memcpy_P(buffer, CH + 7*c, 7);
m.writeSprite(col, 0, buffer);
m.setColumn(col + buffer[0], 0);
col += buffer[0] + 1;
s++;
}
}
void printString1(char* s, int col)
{
int col1 = col;
while (*s != 0)
{
if (*s < 32) continue;
char c = *s - 32;
memcpy_P(buffer, CH + 7*c, 7);
m.writeSprite(col, 0, buffer);
m.setColumn(col + buffer[0], 0);
col += buffer[0] + 1;
s++;
}
}
void lumina()
{
// read photocel
photocellReading = analogRead(photocellPin);
m.setIntensity(photocellReading/150); // LED Intensity 0-15
Serial.print(photocellReading); // the raw analog reading
Serial.print(" lux -> ");
Serial.println(photocellReading/150);
}