File tree 3 files changed +20
-14
lines changed 3 files changed +20
-14
lines changed Original file line number Diff line number Diff line change 1
1
char keyGet () {
2
- T2i = 0 ;
3
- lcdLI ();
4
- return keypad.getKey ();
2
+ char c;
3
+ c = keypad.getKey ();
4
+ if (c > 0 ) {
5
+ T2i = 0 ;
6
+ lcdLI ();
7
+ }
8
+ if (T2i >= T2I) {
9
+ T2i = 0 ;
10
+ lcdLO ();
11
+ }
12
+ return c;
5
13
}
Original file line number Diff line number Diff line change @@ -32,5 +32,6 @@ void lcdLO() {
32
32
lcd.noBacklight ();
33
33
}
34
34
void lcdLI () {
35
+ p (" Light" );
35
36
lcd.backlight ();
36
37
}
Original file line number Diff line number Diff line change 7
7
// LCD
8
8
#include < Wire.h>
9
9
#include < LiquidCrystal_I2C.h>
10
+ // Tiemr
11
+ #include < TimerThree.h>
10
12
11
- // ??
12
- volatile byte state = LOW;
13
- const int T2I = 300 ;
13
+ // TimerVar
14
+ const int T2I = 60 ;
14
15
int T2i = 0 ;
15
16
16
17
// SD variables
@@ -63,12 +64,8 @@ String line2 = "Spravne ";
63
64
String line3 = " Spatne " ;
64
65
/* LANG */
65
66
66
- ISR (TIMER2_OVF_vect ) {
67
+ void TimerAct ( ) {
67
68
T2i++;
68
- if (T2i >= T2I) {
69
- T2i = 0 ;
70
- lcdLO ();
71
- }
72
69
}
73
70
74
71
void setup () {
@@ -86,9 +83,9 @@ void setup() {
86
83
lcdl1 (init2);
87
84
// Wait
88
85
delay (500 );
89
- // Timer2
90
- TIMSK2 = (TIMSK2 & B11111110) | 0x01 ;
91
- TCCR2B = (TCCR2B & B11111000) | 0x07 ;
86
+ // Timer3
87
+ Timer3. initialize ( 150000 ) ;
88
+ Timer3. attachInterrupt (TimerAct) ;
92
89
}
93
90
94
91
void loop () {
You can’t perform that action at this time.
0 commit comments