Updated test code
This commit is contained in:
parent
35828f5242
commit
567f8e96a2
@ -37,7 +37,7 @@ void lock(int mode){
|
||||
}
|
||||
digitalWrite(SERVO_ENABLE_PIN, HIGH);
|
||||
servo.begin();
|
||||
lock_timestamp = current_timestamp + 1000;
|
||||
lock_timestamp = current_timestamp + 500;
|
||||
lock_status = mode;
|
||||
}
|
||||
|
||||
@ -54,6 +54,7 @@ void setup() {
|
||||
pinMode(SERVO_ENABLE_PIN, OUTPUT); // setup pin as output
|
||||
digitalWrite(SERVO_ENABLE_PIN, HIGH);
|
||||
|
||||
servo.setValue(90);
|
||||
servo.begin();
|
||||
}
|
||||
// the loop routine runs over and over again forever:
|
||||
@ -63,9 +64,15 @@ void loop() {
|
||||
// Lock disable timeout
|
||||
if (lock_status > 0) {
|
||||
if (current_timestamp >= lock_timestamp) {
|
||||
servo.end();
|
||||
digitalWrite(SERVO_ENABLE_PIN, LOW);
|
||||
lock_status = 0;
|
||||
if (lock_status < 3) {
|
||||
servo.setValue(90);
|
||||
lock_timestamp = current_timestamp + 500;
|
||||
lock_status = 3;
|
||||
}else{
|
||||
servo.end();
|
||||
digitalWrite(SERVO_ENABLE_PIN, LOW);
|
||||
lock_status = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Heartbeat
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user