@@ -55,6 +55,11 @@ void loop() {
55
55
else if (command.startsWith (" test" )) {
56
56
testCodes (command.substring (4 ));
57
57
}
58
+ else if (command.startsWith (" input" )) {
59
+ prefix = command.substring (5 , 6 );
60
+ inCode = command.substring (6 );
61
+ wholeCode = true ;
62
+ }
58
63
}
59
64
if (wg.available ())
60
65
{
@@ -78,29 +83,31 @@ void loop() {
78
83
inCode = String (wg.getCode (),HEX);
79
84
wholeCode = true ;
80
85
}
81
- // Serial.print(prefix + inCode);
82
- if (wholeCode) {
83
- String prac = " " ;
84
- prac = prefix + inCode ;
85
- if ( testCodes (prac)) {
86
- keyUnlock (keylockPin, openMillis);
87
- inCode = " " ;
88
- wholeCode = false ;
89
- }
86
+ }
87
+ // Serial.print(prefix + inCode);
88
+ if (wholeCode) {
89
+ String prac = " " ;
90
+ prac = prefix + inCode;
91
+ if ( testCodes (prac)) {
92
+ keyUnlock (keylockPin, openMillis) ;
93
+ inCode = " " ;
94
+ wholeCode = false ;
90
95
}
91
96
}
92
97
}
93
98
94
99
void keyUnlock (byte pin, int time) {
95
100
digitalWrite (pin, LOW);
96
101
digitalWrite (monitorPin, HIGH);
102
+ Serial.println (" UNLOCKED..." );
97
103
delay (time );
98
104
// if code is in web codes too - kill open command
99
105
while (Serial.available ()) {
100
106
byte inByte = Serial.read ();
101
107
}
102
108
digitalWrite (pin, HIGH) ;
103
109
digitalWrite (monitorPin, LOW);
110
+ Serial.println (" LOCKED..." );
104
111
}
105
112
106
113
void listCodes () {
0 commit comments