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);
|
digitalWrite(SERVO_ENABLE_PIN, HIGH);
|
||||||
servo.begin();
|
servo.begin();
|
||||||
lock_timestamp = current_timestamp + 1000;
|
lock_timestamp = current_timestamp + 500;
|
||||||
lock_status = mode;
|
lock_status = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,6 +54,7 @@ void setup() {
|
|||||||
pinMode(SERVO_ENABLE_PIN, OUTPUT); // setup pin as output
|
pinMode(SERVO_ENABLE_PIN, OUTPUT); // setup pin as output
|
||||||
digitalWrite(SERVO_ENABLE_PIN, HIGH);
|
digitalWrite(SERVO_ENABLE_PIN, HIGH);
|
||||||
|
|
||||||
|
servo.setValue(90);
|
||||||
servo.begin();
|
servo.begin();
|
||||||
}
|
}
|
||||||
// the loop routine runs over and over again forever:
|
// the loop routine runs over and over again forever:
|
||||||
@ -63,9 +64,15 @@ void loop() {
|
|||||||
// Lock disable timeout
|
// Lock disable timeout
|
||||||
if (lock_status > 0) {
|
if (lock_status > 0) {
|
||||||
if (current_timestamp >= lock_timestamp) {
|
if (current_timestamp >= lock_timestamp) {
|
||||||
servo.end();
|
if (lock_status < 3) {
|
||||||
digitalWrite(SERVO_ENABLE_PIN, LOW);
|
servo.setValue(90);
|
||||||
lock_status = 0;
|
lock_timestamp = current_timestamp + 500;
|
||||||
|
lock_status = 3;
|
||||||
|
}else{
|
||||||
|
servo.end();
|
||||||
|
digitalWrite(SERVO_ENABLE_PIN, LOW);
|
||||||
|
lock_status = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Heartbeat
|
// Heartbeat
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user