Showing
1 changed file
with
3 additions
and
9 deletions
... | @@ -11,14 +11,9 @@ int time = 0; | ... | @@ -11,14 +11,9 @@ int time = 0; |
11 | int data[] = { 0,0,0,0,0,0 }; | 11 | int data[] = { 0,0,0,0,0,0 }; |
12 | int state = 2; | 12 | int state = 2; |
13 | 13 | ||
14 | -int KeypadRead() | 14 | +int KeypadRead(){ |
15 | -{ | ||
16 | int i, keypadnum = -1; | 15 | int i, keypadnum = -1; |
17 | - for (i = 0; i < 3; i++) { | 16 | + if (!digitalRead(Keypad[0])) { |
18 | - if (!digitalRead(Keypad[i])) { | ||
19 | - state = 1; | ||
20 | - keypadnum = i; break; | ||
21 | - } | ||
22 | } | 17 | } |
23 | return keypadnum; | 18 | return keypadnum; |
24 | } | 19 | } |
... | @@ -56,7 +51,6 @@ void timer() { | ... | @@ -56,7 +51,6 @@ void timer() { |
56 | } | 51 | } |
57 | } | 52 | } |
58 | void stop() { | 53 | void stop() { |
59 | - timer(); | ||
60 | state = 1; | 54 | state = 1; |
61 | } | 55 | } |
62 | void reset() { | 56 | void reset() { |
... | @@ -106,7 +100,7 @@ int main(){ | ... | @@ -106,7 +100,7 @@ int main(){ |
106 | timer(); | 100 | timer(); |
107 | } | 101 | } |
108 | } | 102 | } |
109 | - else if (state > 0) { | 103 | + else { |
110 | while (1) { | 104 | while (1) { |
111 | timer(); | 105 | timer(); |
112 | } | 106 | } | ... | ... |
-
Please register or login to post a comment